Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third level must have 1 + 2 + 3 = 6 cubes, and so on. Thus, the i-th level of the pyramid must have 1 + 2 + ... + (i - 1) + i cubes.Vanya wants to know what is the maximum height of the pyramid that he can make using the given cubes.

The first line contains integer n (1 ≤ n ≤ 104) — the number of cubes given to Vanya.

Print the maximum possible height of the pyramid in the single line.

var
n,i,k,k1,s,s1,k2,l:longint;
begin
read (n,l); s:=1; k2:=1; k1:=1;
while n>=s do begin
inc (k2);
for i:=1 to k2 do
s1:=s1+i;
s:=s+s1;
s1:=0;
if n-s>=0 then begin
inc (k1);
end
else break;
end;
write (k1);
end.

var i, KolKyb, KolKybVYrov : Integer;
begin
  Readln(KolKyb);
  KolKybVYrov := 0;
  i := 0;
  While KolKybVYrov <= KolKyb do
    begin
      KolKyb := KolKyb - (KolKybVYrov);
      Inc(i);
      KolKybVYrov := KolKybVYrov + i;
    end;
  Writeln(i - 1);
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i, n, j, t: Integer;
  b: Boolean;

begin
  Readln(n);
  i := 0;
  t := 0;
  b := true;
  while b do begin
    i := i + 1;
    t := t + i;
    for j := 1 to t do begin
      if n = 0 then begin b := False; Break; end;
      n := n - 1;
    end;
  end;

  Writeln(i-1);
  Readln;

end.

var a,n,i:integer;
begin
readln(n);
a:=0;
for i:=1 to n+1 do begin
a:=a+i;
if a>n then break;
n:=n-a;
end;
write(i-1);
end.

var i,n,k:longint;
begin
    read(n);
    k:=1;
    i:=1;
    repeat
        inc(i);
        k:=k+i*(i+1)div 2
    until k>n;
    write(i-1)
end.

var     s,n,i:longint;
begin
        readln(n);
        while s<=2*n do begin
                         inc(i);
                         s:=s+(sqr(i)+i);
                       end;
        write(i-1);
end.

{const fi='vyac.inp';
      fo='vyac.out';}
var n,i,s,m,j:longint;
procedure docdl;
begin
{ assign(input,fi);
 reset(input);
 assign(output,fo);
 rewrite(output);     }
 read(n);
end;
procedure xuli;
begin
 i:=0;s:=0;
 repeat
  inc(i);
  m:=0;
  for j:=1 to i do m:=m+j;
  s:=s+m;
  if s>=n then break;
 until s>=n;
end;
procedure ghikq;
begin
if s>n then writeln(i-1);
if s=n then writeln(i);
{close(input);
close(output);         }
end;
Begin
 docdl;
 xuli;
 ghikq;
end.

program z1;
var n,i,k,br:longint;
begin
read(n);
i:=1;
k:=1;
while n-k>=0  do
        begin
          n:=n-k;
          i:=i+1;
          k:=k+i;
          br:=br+1;
        end;
writeln(br);
end.

var a,n,t,m:integer;
begin
a:=1;
t:=1;
m:=1;
readln(n);
while a+m+t+1<=n do
 begin
 inc(t);
 m:=m+t;
 a:=a+m;
 end;
writeln(t);
end.

var i,n:longint;
 sum,y:int64;
 Begin
  read(n);
  if n=1 then begin writeln(1); halt; end;
  for i:=1 to n do
   Begin
    y:=y+i;
    sum:=sum+y;
     if sum>n then begin writeln(i-1); halt; end;
   End;
 End.

var i,k,n,sum,sum1:int64;
begin
readln(n);
i:=0;
while n>=sum1 do begin
i:=i+1;
sum:=sum+i;
sum1:=sum1+sum;
end;
writeln(i-1);
end.

var n,a,m:longint;ans,i:integer;
begin
 readln(n);
 if n = 1 then writeln('1')
          else begin
                a:=1;
                ans:=1;
                m:=1;
                while (a<=n) do
                      begin
                       inc(ans);
                       m:=m+ans;
                       a:=a+m;
                      end;

                if a = n then writeln(ans)
                         else writeln(ans-1);
               end;

end.

var
 n,k,i,j,m:longint;
begin
  read(n);
  i:=1;
  k:=1;
  while n-k>=0 do
   begin
    n:=n-k;
    i:=i+1;
    k:=0;
    for j:=1 to i do k:=k+j;
   end;
  write(i-1);
end.

program z1;
 var n,m,i:longint;
function f1(a,r,k:longint):longint;
begin
 if(a+k>m)
  then f1:=r
  else f1:=f1(a+k,r+1,k+r+2);
end;
begin
 readln(m);
 writeln(f1(0,0,1));
end.

var
 n,k,i,j:longint;
begin
 read(n);
 i:=1;
 k:=1;
 while n-k>=0 do
   begin
     n:=n-k;
     i:=i+1;
     k:=0;
     for j:=1 to i do k:=k+j;
  end;
 write(i-1);
end.

var
s,s1:string;
n,m,j,i,k,q,w,kod:longint;
a,b:array[1..100000] of longint;
begin
    {assign(input,'input.txt');
    assign(output,'output.txt');
    reset(input);
    rewrite(output);}
    read(n);
    k:=0;
    for i:=1 to n do
    begin
        for j:=1 to i do
        begin
            k:=k+j;
        end;

        if q+k<=n then q:=q+k
        else
        begin
            write(i-1);
            exit;
        end;
        if q=n then
        begin
            write(i);
            exit;
        end;
        k:=0;
    end;
end.

program z1;
var n, k, i : integer;
begin
  read(n);
  k := 1;
  while n - k >= 0 do
    begin
      i := i + 1;
      n := n - k;
      k := k + i + 1;
    end;
  write(i);
end.

Var a : array[1..10000]of longint;
    i,j,k,l,n,m,t,c : Longint;
begin
  readln(n);
   While t <= n DO
    begin
     inc(i);
     k := round((1 + i) / 2 * i);
     inc(t,k);
    end;
   if (t > n) then
   writeln(i - 1)
   else writeln(i);
end.

program easy;
var n,s,i:integer;

begin
  readln(n);
  s:=1;
  i:=1;
  while(s<=n)do
    begin
      Inc(i);
      s:=s+Round(i*(i+1)/2);
    end;
  write(i-1);
end.

var
n,q,w,e,o:longint;
begin
read(n);
q:=1;
w:=1;
e:=1;
o:=1;
if n>q
then
while w+q+e+1<=n do
begin
inc(e);
q:=q+e;
w:=w+q;
Inc(o);
end;
write(o);
end.

var i,l,k,n:longint;
begin
readln(n);

while l<n do
begin
i:=i+1;
l:=l+i;
n:=n-l;
if n>=0 then
k:=k+1;
end;

writeln(k);

end.

var i,j,k,n,sum,cou:longint;
begin
  readln(n);
  if n>=4 then begin
  for i:=1 to n do
   begin
    cou:=cou+i;
    sum:=sum+cou;
    if sum>n then write(i-1);
    if sum>n then break;
   end;

  end
  else write(1);
  readln;
  readln;
end.

var
  n,i:longint;
begin
  readln(n);
  while n-((1+i)*i div 2)>=0 do
  begin
    n:=n-(1+i)*i div 2;
    inc(i);
  end;
  writeln(i-1);
end.

var n,i,sum,c:longint;
begin
read(n);
sum:=0;
i:=0;
c:=0;
while n>=sum do
begin
i:=i+1;
sum:=sum+i;
if n<sum then i:=i-1;
n:=n-sum;

end;
write(i);
end.

Var n : longint;
    i,count,j,k : longint;
    f1,f2 : text;
Begin
 Assign(f1,''); Reset(f1);
 Readln(f1,n);
 j:=0;
 i:=0;
 count:=0;
 while (k+j+i+1<=n) do
  Begin
   inc(count);
   i:=i+1;
   j:=j+i;
   k:=k+j;
  End;
 Assign(f2,''); Rewrite(f2);
 Writeln(f2,count);
 Close(f2);
End.

var a,n,t,m:integer;
begin
a:=1;
t:=1;
m:=1;
readln(n);
while a+m+t+1<=n do
 begin
 inc(t);
 m:=m+t;
 a:=a+m;
 end;
writeln(t);
end.

var n,i,j:longint;
begin
	readln(n);
	i:=0;
	j:=1;
	while n>=j do
	begin
		inc(i);
		dec(n,j);
		inc(j,i+1);
	end;
	writeln(i);
end.

var s,i,n:longint;
begin
    readln(n); i:=1; s:=0;
    while (1=1) do
    begin
        s:=s+i*(i+1) div 2;
        if (s>=n) then break else inc(i);
    end;
    if (s>n) then dec(i);
    writeln(i);
end.

var
n,k,i,j:longint;
begin
readln(n);
i:=1;
k:=1;
while n-k>=0 do
  begin
    n:=n-k;
    i:=i+1;
    k:=0;
    for j:=1 to i do k:=k+j;
  end;
write(i-1);
end.

var
  n,i,x,y,sum:longint;
begin
  readln(n);
  for i:=1 to n do
  begin
    x:=y+i;
    sum:=sum+x;
    if sum>n then begin writeln(i-1);exit;end;
    if sum=n then begin writeln(i);exit;end;
    y:=x;
  end;
end.

var i,j,rs,s,n:integer;
begin
i:=2;
j:=1;
s:=0;
rs:=0;
readln(n);
while n>0 do
begin
  s:=s+j;
  n:=n-j;
  j:=j+i;
  inc(i);
  inc(rs);
end;
if n<0 then dec(rs);
writeln(rs);
end.

program VANYA_AND_CUBE;
const fi='';
      fo='';
var N,d,T,tr: integer;
    a: array[0..10000] of longint;
procedure doc;
var f: text;
begin
  assign(f,fi);
  reset(f);
  readln(f,N);
  close(f);
end;
procedure xu_ly;
var i: integer;
begin
   A[0]:=0;
  for i:=1 to 10000 do
     A[i]:=A[i-1]+i;
  T:=0;
  d:=1;
  tr:=0;
  for i:=1 to 39 do
    begin
     T:=T+A[i];
     if T>N then
       begin
        d:=i-1;
        break;
       end;
    end;
end;
procedure ghi;
var f: text;
begin
  assign(f,fo);
  rewrite(f);
  writeln(f,d);
  close(f);
end;
BEGIN
  doc;
  xu_ly;
  ghi;
END.

var
i,j,otv,sum,n:longint;
begin
readln(n);
i:=0;
while true do begin
    inc(i);
     for j:=1 to i do sum:=sum+j;
     inc(otv);
           if sum>n then break;

end;
if sum=n then writeln(otv)
else
writeln(otv-1);
end.

var  n,i,ans,sum,x : longint;
begin
 //assign (input,'input.txt'); reset (input);
 //assign (output,'output.txt'); rewrite (output);

 read (n);

 ans := 0;
 sum := 0;

 for i := 1 to n+1 do begin

    x := x + i;
    sum := sum + x;
    inc (ans);
    if (sum > n) then begin
        writeln (ans - 1);
        break;
    end;
 end;

// close (input); close (output);
end.

var
s,n,p,i,j,k:integer;

begin
readln(n);

s:=0;
p:=0;
repeat
i:=i+1;
s:=s+i;
p:=p+s;
if p<=n then
j:=j+1;
until p>n;
writeln(j);
end.

{$mode objfpc}
var n,i,count:integer;
function sum(n:integer):integer;
   var i:integer;
   begin
      sum:=0;
      for i:=1 to n do sum:=sum+i;
   end;
begin
   readln(n);
   count:=0;i:=1;
   while sum(count+1)<=n do
      begin
         inc(count);
         i:=sum(count);
         n:=n-i;
       //  writeln(i,' ',count,' ',n);
      end;
   writeln(count);
end.

var x:integer;
function Cub(x:integer):integer;
var k,s,sum:integer;
begin
k:=0;s:=0;cub:=0;sum:=0;
while sum<=x do begin
cub:=s;
s:=s+1;
k:=k+s;
sum:=sum+k;
end;
end;
begin
read(x);
write(cub(x));
end.

const fi='';
      fo='';
var i,n,s:int64;
        f,g:text;
procedure data;
begin
        assign(f,fi); assign(g,fo);
        reset(f); rewrite(g);
        readln(f,n);
end;
procedure process;
begin
        s:=0;
        i:=0;
        while (n>0) do
        begin
                inc(i);
                inc(s,i);
                dec(n,s);
        end;
        if n<0 then writeln(g,i-1)
        else writeln(g,i);
end;
begin
        data;
        process;
        close(g);
end.

var n,i,v,s:integer;
begin
v:=1;
s:=1;
i:=1;
Readln(n);
while(s<n) do
begin
i:=i+1;
s:=s+(i*(i+1) div 2);
end;
if(s-n>0) then dec(i);
writeln(i);
end.

var
i,k,m,s:longint;
begin
readln(m);
s:=1; k:=0;
while m>=s do
begin
m:=m-s;
k:=k+1;
s:=s+k+1;
end;
writeln(k);
end.

var     s,n,i:longint;
begin
        readln(n);
        while s<=2*n do begin
                         inc(i);
                         s:=s+(sqr(i)+i);
                       end;
        write(i-1);
end.

{$mode objfpc}
var
        i, n, s: integer;

begin
        readln(n);
        i := 0;
        while n-s-i > 0 do
        begin
                inc(i);

                inc(s, i);
                dec(n, s);
        end;
        writeln(i)
end.

program kubix;
var n,count,sum,h:integer;
begin
readln(n);
while n>=((2+count)*(count+1))div 2 do
begin
count:=count+1;
sum:=((1+count)*count)div 2;
n:=n-sum;
end;
writeln(count);
end.

var k,b,c,s:integer;
begin
readln(k);
b:=1; c:=0; s:=2;
while k-b>=0 do
begin
k:=k-b;
b:=b+s;
s:=s+1;
inc(c); end;
writeln(c);
end.

var
 i,n,s,t:longint;
begin
  readln(n);
  while n>=t do
    begin
      s:=s+1;t:=t+s;
      n:=n-t;inc(i);
    end;
  if n<0 then dec(i);
  writeln(i);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  var i,n,k,s:integer;
begin
readln(n);
k:=0;
i:=1;
s:=0;
while n>0 do begin
  s:=s+i;
  n:=n-s;
  if (n>=0) then inc(k);
  inc(i);
end;
writeln(k);
end.

program z1;
var n,i,k,br:longint;
begin
read(n);
i:=1;
k:=1;
while n-k>=0  do
        begin
          n:=n-k;
          i:=i+1;
          k:=k+i;
          br:=br+1;
        end;
writeln(br);
end.

Program kyb;
var
n, i:integer;
A:array[0..1000] of int64;
begin
  read(n);
  if (n=1) then
    write ('1')
  else
  begin
    i:=1;
    A[0]:=0;
    while (A[i-1]<=n) do
    begin
      A[i]:=(i*(i+1) div 2) + A[i-1];
      i:=i+1;
    end;
    write(i-2);
  end;
end.

program A492;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var n,m,k,i,s : longint;
begin
readln(n);
m := 0;
k := 0;
while m <= n do
 begin
   s := 0;
   inc(k);
   for i := 1 to k do s := s+i;
   m := m + s;
 end;
writeln(k-1);
end.

var t,m,f:int64;
begin
read(m);
while f<=m*2 do
begin
inc(t);
f:=f+t*(t+1);
end;
write(t-1);
end.

var
i,n,t,q,s:longint;
begin
read(n);
while s<n do begin
inc(q);
s:=s+q;
if s<=n then inc(t);
n:=n-s;
end;
write(t);
end.

{$Mode objfpc}
var n,res,t,i:integer;
    s:array[1..100000] of integer;
begin
  readln(n);
  s[1]:=1;
  i:=1;
  t:=1;
  while t<n do
  begin
    i:=i+1;
    s[i]:=s[i-1]+i;
    t:=t+s[i];
  end;
  if t=n then writeln(i) else
  writeln(i-1);
end.

program Intelect;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Math;

var
   n, kol, i, w :integer;

begin
    //reset(input, 'input.txt');
    //rewrite(output, 'output.txt');
    readln(n);
    kol := 1;
    n := n - 1;
    w := 1;
    for i := 2 to 100000 do
    begin
        w := w + i;
        if (n >= w) then
        begin
            inc(kol);
            dec(n, w);
        end
        else
            break;
    end;
    writeln(kol);

    readln;
    readln;
end.

var
    n, i, sum, ans : longint;

begin
    sum := 0; i := 1;
    read(n);
    for i := 1 to n do
    begin
        sum := sum + i * (i + 1) div 2;
        if sum <= n then
            ans := i
        else
        begin
            ans := i - 1;
            break;
        end
    end;
    write(ans);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, i, k: integer;
begin
  readln(n);
  k:= 1;
  i:= 1;
    while true do
      begin
        if n - k >= 0 then dec(n,k)
                      else break;
        inc(i);
        inc(k,i);
      end;
  writeln(i-1);
  readln;
end.

var
n,k,i,j:longint;
begin
readln(n);
i:=1;
k:=1;
while n-k>=0 do
  begin
    n:=n-k;
    i:=i+1;
    k:=0;
    for j:=1 to i do k:=k+j;
  end;
write(i-1);
end.

program a280;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  k, t : integer;
  f : boolean;
  p : int64;

begin
  {assign(input, 'input.txt');
  reset(input);
  assign(output, 'output.txt');
  rewrite(output);  }
  readln(t);
  p := 1;
  k := 0;
  f := true;
  while f do
    begin
      if t - p >= 0 then
        begin
          t := t - p;
          inc(k);
          p := p + (k + 1);
        end
        else
          begin
            writeln(k);
            halt(0);
          end;
    end;
end.

var i,j,k,l,m,n:longint;
begin
readln(n);
i:=0;
m:=0;
while (m<n) do
begin
inc(i);
k:=k+i;
m:=m+k;
end;
if m>n then writeln(i-1) else writeln(i);
end.

var s,i,n:longint;
begin
    readln(n); i:=1; s:=0;
    while (1=1) do
    begin
        s:=s+i*(i+1) div 2;
        if (s>=n) then break else inc(i);
    end;
    if (s>n) then dec(i);
    writeln(i);
end.

{$MODE OBJFPC}
program onlylove;
var n : int64;
    d ,pre,tmp: int64;
    i : integer;
begin
   readln(n);
   d := 0;
   pre:=0;
   tmp:=0;
   for i:=1 to 69 do
      begin
         inc(d);
         pre := pre+tmp;
         tmp:=tmp+i;
         if pre > n then
            begin
               Writeln(d-2);
               halt;
            end;
      end;
end.

var     s,n,i:longint;
begin
        readln(n);
        while s<=2*n do begin
                         inc(i);
                         s:=s+(sqr(i)+i);
                       end;
        write(i-1);
end.

var
i,j,c,d,e,n:longint;
begin
read(n);
for i:=1 to 40 do
if (i*(i+1)*(i+2) div 6>n) then break;
writeln(i-1);
end.

var a,summ,curr,i:Longint;
BEGIN
summ:=0;
read(a);
i:=0;
curr:=1;
while summ+curr<=a do
        begin
                inc(i);
                inc(curr,i);
                inc(summ,curr);
        end;

if(a=0) then write(0) else write(i);
END.

var
  n,i,x,sum:longint;
begin
  readln(n);
  for i:=1 to n do
  begin
    x:=x+i;
    sum:=sum+x;
    if sum>n then begin writeln(i-1);exit;end;
    if sum=n then begin writeln(i);exit;end;
  end;
end.

var a,n,i:integer;
begin
readln(n);
a:=0;
for i:=1 to n+1 do begin
a:=a+i;
if a>n then break;
n:=n-a;
end;
write(i-1);
end.

var ans,h: longint;
    t,s: int64;
begin
    t:=1;
    ans:=1;
    readln(s);
    h:=1;
    while (t<s) do
    begin
        inc(ans,h+1);
        inc(h);
        inc(t,ans)
    end;
    if (t>s) then dec(h);
    write(h);
end.

var
 n,k,i,j,m:longint;
begin
  read(n);
  i:=1;
  k:=1;
  while n-k>=0 do
   begin
    n:=n-k;
    i:=i+1;
    k:=0;
    for j:=1 to i do k:=k+j;
   end;
  write(i-1);
end.

var
	n, i, count, tmp: integer;
begin
	readln(n);
	while true do
		begin
			i:=i + 1;
			count:=count + tmp + i;
			tmp:=tmp + i;
			if (count = n) then
				begin
					write(i);
					exit;
				end;
			if (count > n) then
				begin
					write(i - 1);
					exit;
				end;
		end;
end.

{$mode objfpc}
var
        i, n: integer;

begin
        readln(N);
        if N <= 0 then begin writeln(0); exit end;
        i := 1;
        while N - i*(i+1) div 2 >= 0 do
        begin
                dec(N, i*(i+1) div 2);
                inc(i)
        end;
        writeln(i-1);
        readln
end.

var n,i,sum,c:longint;
begin
read(n);
sum:=0;
i:=0;
c:=0;
while n>=sum do
begin
i:=i+1;
sum:=sum+i;
if n<sum then i:=i-1;
n:=n-sum;

end;
write(i);
end.

var
n,q,w,e,o:longint;
begin
read(n);
q:=1;
w:=1;
e:=1;
o:=1;
if n>q
then
while w+q+e+1<=n do
begin
inc(e);
q:=q+e;
w:=w+q;
Inc(o);
end;
write(o);
end.

 var  i,m,n,q:longint;
 begin
  read (n);
  while m<n do
   begin
    i:=i+1;
    q:=q+i;
    m:=m+q;
    end;
    if m=n then
   write  (i)
   else write (i-1);
  end.

var n,i,j,kq:longint;
begin
    readln(n);
    i:=0;j:=0;kq:=0;
    while (n > i) do
    begin
        inc(j);
        inc(i,j);
        n:=n-i;
        if n >= 0 then
            inc(kq);
    end;
    write(kq);
end.

CONST fi = '';
      fo = '';
VAR N, i, S : word;
    F : array [0..1000] of word;
PROCEDURE SOLVE;
 Begin
        F[0] := 0;
        S := 0;
        i := 0;
        repeat
                inc(i);
                F[i] := F[i-1] + i;
                S := S + F[i];
        until S >= N;
 End;
PROCEDURE PROCESS;
 Var f : text;
 Begin
        assign(f,fi); reset(f);
        read(f,N);
        close(f);
        assign(f,fo); rewrite(f);
        SOLVE;
        if S > N then write(f,i-1) else write(f,i);
        close(f);
 End;
BEGIN
        PROCESS;
END.

var i,n:longint;
 sum,y:int64;
 Begin
  read(n);
  if n=1 then begin writeln(1); halt; end;
  for i:=1 to n do
   Begin
    y:=y+i;
    sum:=sum+y;
     if sum>n then begin writeln(i-1); halt; end;
   End;
 End.

var   n,i,res   : longint;
      l         : array[-1..1000000] of longint;
begin
      readln(n);
      l[-1]:=0;
      l[0]:=0;
      res:=0;
      for i:=1 to n do
      begin

              inc(res);l[i]:=(l[i-1]-l[i-2])*2+i+l[i-2];
              if l[i]>=n then break;
              if l[i-1]+(l[i]-l[i-1])*2+i+1>n then break;

      end;
      writeln(res);
end.

var
i,j,c,d,e,n:longint;
begin
read(n);
for i:=1 to 40 do
if (i*(i+1)*(i+2) div 6>n) then break;
writeln(i-1);
end.

var
n,i,k,k1,s,s1,k2:longint;
begin
read (n); s:=1; k2:=1; k1:=1;
while n>=s do begin
inc (k2);
for i:=1 to k2 do
s1:=s1+i;
s:=s+s1;
s1:=0;
if n-s>=0 then begin
inc (k1);
end
else break;
end;
write (k1);
end.

                                            {***ABDU**}
var i,j,n,m:integer; begin read(n);
while m<=n do begin
n:=n-m; inc(i); m:=m+i; end;
writeln(i-1);
end.

var i,j,rs,s,n:integer;
begin
i:=2;
j:=1;
s:=0;
rs:=0;
readln(n);
while n>0 do
begin
  s:=s+j;
  n:=n-j;
  j:=j+i;
  inc(i);
  inc(rs);
end;
if n<0 then dec(rs);
writeln(rs);
end.

Var
  n,i,k:integer;
begin
  readln(n); i:=1; k:=1;
  while n-k>=0 do begin n:=n-k; inc(i); k:=k+i; end;
  writeln(i-1);
end.

    const  eps=1e-11;  besk=200000000000000008;

   label 1,2,3,4;
    type
    mas=array [-10000..10000000] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-10000..2000000] of int64;mass1=^mas;
    var t,aa,bb,sum1,dist,modul,n,m,poz,sum,p3,p4,t4,t5,t6,t1,t2,t3,jj,pold,xx,yy,pp,n2,ost,ll,rr,p,q,tt,n1,h,kk,qq,ot,kol,nn,x0,y0,s1,s2,s,imax,smin,dl,besk1:int64;
    shag,imin,ii,k,i1,i2,i3,i4,i5,i6,i7,j1,j2,mask,step,i,j:longint;
     sssnew:array[-10..10000] of char;
    poin:zap;     cc,edin:mas;
    vec:array[-100..1000] of zap;
    c,aold,anew,b1,fact,d, a1,bl,br,a,b:mas;
     c1:array[-1..301,-100..301] of int64;
    ss, ss1,ss2:string;
    ch1,ch2:char;
    newgr,gr:array[-100..200000] of boolean;
    dd,pole:array[-1..1500,-1..1500] of int64;
    sss:array[-100..1000000] of string;
    ch: char;
    zan,marked:array[-10..1000000] of boolean;
    maxpr:array[0..100000] of string;
     p1,p2,pr,aanew,v0,v1,s0,t0:extended;
     lx,ly,rx,ry,z,x1,y1,y,x:array[-1..300000] of int64;
    xm,xn, xxx,yyy:array[-1..100000] of double;
    xxnew,per,pp2, ee,yot:double;
       flagg,flag2,flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

  function evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
  tt:zap; tt1:zap1;
begin
  if a<b then begin r:=a;a:=b;b:=r; end;
  x2:=1;x1:=0;y2:=0;y1:=1;
  while b>0 do
    begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
          a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;
    end;
    d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt;
   evkl:=tt1;
end;

function degg(a:int64;k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=(degg(a,k-1)*a) mod modul  else
   begin  p:=degg(a,k div 2); degg:=(p*p) mod modul;    end;

end;

begin

 { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }

   read(n);
 for i:=0 to 1000 do a[i]:=i;
 for i:=0 to 1000 do b[i]:=b[i-1]+a[i];
 for i:=0 to 1000 do c[i]:=c[i-1]+b[i];
{ for i:=0 to 10 do writeln(i,' ',a[i],' ',b[i],' ',c[i]);
} for i:=0 to 1000 do if c[i]<=n then ot:=i;
 writeln(ot);

     1:          close(output);
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='a';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    nt,ii,jj,kk,nn,mm,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3,cur,res,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n);
  k:=0;
  res:=0;
  i:=0;
  while n>=0 do
    begin
    inc(i);
    inc(k,i);
    dec(n,k);
    inc(res);
    end;
  writeln(res-1);

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

var t,m,f:int64;
begin
read(m);
while f<=m*2 do
begin
inc(t);
f:=f+t*(t+1);
end;
write(t-1);
end.

var n, i, j, h: longint;
begin
  readln(n);
  j:=1;
  i:=1;
  while n >= j do
    begin
      n:=n-j;
      inc(h);
      inc(i);
      j:=j+i;
    end;
  write(h);
end.

var n,i:longint;
  res:longint;
begin
     read(n);
     i:=1;      res:=0;
     while n>0 do
       begin
           dec(n,i);
           i:=i+2;
       end;
     if n<0 then  dec(res);
end.

var
 sum:int64;
 x,i:longint;
begin
 read(x);
 i:=2;
 sum:=1;
 while sum<=x do
  begin
   sum:=sum+i;
   inc(i);
  end;
  writeln(i);
end.

Var a : array[1..10000]of longint;
    i,j,k,l,n,m,t,c : Longint;
begin
  readln(n);
   While t + i <= n DO
    begin
     inc(i);
     inc(k,round((1 + i) / 2 * i));
     inc(t,k);
    end;
   writeln(i);
end.

{$mode objfpc}
var n,i,count:integer;
function sum(n:integer):integer;
   var i:integer;
   begin
      sum:=0;
      for i:=1 to n do sum:=sum+i;
   end;
begin
   readln(n);
   count:=0;i:=1;
   while i<=n do
      begin
         inc(count);
         i:=sum(count);
         n:=n-i;
       //  writeln(i,' ',count,' ',n);
      end;
   writeln(count);
end.

program VANYA_AND_CUBE;
const fi='';
      fo='';
var N,d,T,tr: integer;
procedure doc;
var f: text;
begin
  assign(f,fi);
  reset(f);
  readln(f,N);
  close(f);
end;
procedure xu_ly;
var i: integer;
begin
  {d:=1;
  T:=1;
  tr:=1;
  while T<N do
    begin
     inc(d);
     T:=tr+d;
     tr:=tr+T;
    end;}
  T:=0;
  d:=1;
  tr:=0;
  for i:=1 to N do
    begin
     T:=tr+i;
     tr:=tr+T;
     if T>N then
       begin
        d:=i-1;
        break;
       end;
    end;
end;
procedure ghi;
var f: text;
begin
  assign(f,fo);
  rewrite(f);
  writeln(f,d);
  close(f);
end;
BEGIN
  doc;
  xu_ly;
  ghi;
END.

var i, n, x, k, ans:integer;
begin
	readln(n);
	i := 0;
    k := 0;
	while n > k do begin
		inc(i);
		k := i + k;
		n := n - k;
	end;
	writeln(i);
end.

Var k,n,i,j,z : longint ;
begin
readln(n) ; k:=2 ; z:=1 ; i:=1 ;
while n-k-i>0 do begin
n:=n-k ;
n:=n-i ;
k:=k+1 ;
i:=i+k ;
z:=z+1 ;
end ;
writeln(z) ;
end.

Var
  n,i,k:integer;
begin
  readln(n); i:=1; while n-i-1>0 do begin inc(i); n:=n-i; end; writeln(i);
end.

var n:longint;
    m,t,r,l:real;
begin
  readln(n);
  l:=0;
  r:=1000;
  while abs(r-l)>0.01 do
  begin
    m:=(l+r)/2;
    t:=(m*m*m+3*m*m+2*m)/6;
    if t>n then
      r:=m;
    if t<n then
      l:=m;
  end;
  writeln(trunc(m));
end.

var
  n,i,x,y,sum:longint;
begin
  readln(n);
  x:=1;
  for i:=1 to n do
  begin
    sum:=sum+x+i;
    if sum>n then begin writeln(i-1);exit;end;
    if sum =n then begin writeln(i);exit;end;
    inc(x);
  end;
end.

Program PBA;
Var n,i,t:longint;
Begin
readln(n);
i:=0;
t:=0;
While t+(i+1)<=n do
Begin
inc(i);
t:=t+i;
End;
write(i);
End.

var
 sum:int64;
 x,i:longint;
begin
 read(x);
 i:=2;
 sum:=1;
 while sum<x do
  begin
   sum:=sum+i;
   inc(i);
  end;
  writeln(i-1);
end.

var
i, m, n, t, q : integer;
begin
        read(n);
        m := 1;
        while (n >= t)  do
                begin
                m := m + 1;
                t := t +(t + m);
                q := q + 1;
                end;
        write(q);
end.

//492a
var n,i,k:int64;
begin
read(n);
while k<=n do
begin

 k:=i+2*k;
 if k<=n then inc(i);

end;

write(i-1);
end.

{$MODE OBJFPC}
var
    n, i, dem, j: integer;
    s: int64;
begin
    readln(n);
    i := 1;
    j := 1;
    if n = 0 then begin
        writeln(0);
        exit;
    end;
    repeat
        s := s + i;
        inc(j);
        i := i + j;
        inc(dem);
    until s >= n;
    if dem <= 1 then write(dem) else
    writeln(dem - 1);
end.

var i,n,j,k: integer;
begin
read(n);
k:=0;
i:=1;
j:=1;
while n>i do begin
 n:=n-i;
 i:=i+j;
 j:=j+1;
 k:=k+1;
end;
write(k);
end.

var
a,b,c,d,e,f,g,h,i:integer;
begin
readln(a);
c:=1;
while (b<a) do
begin
for d:=1 to c do
e:=e+d;
b:=b+e;
if (a>b) then
c:=c+1;
if b=a-1 then
c:=c-1;
end;
writeln(c);
readln
end.

Var n : longint;
    i,count,j : longint;
    f1,f2 : text;
Begin
 Assign(f1,''); Reset(f1);
 Readln(f1,n);
 j:=0;
 i:=0;
 count:=0;
 while (j+i+1<=n) do
  Begin
   inc(count);
   i:=i+i+1;
   j:=j+i;
  End;
 Assign(f2,''); Rewrite(f2);
 Writeln(f2,count);
 Close(f2);
End.

var
 n,k,i:longint;
begin
 read(n);
 i:=1;
 k:=1;
 while n-k>=0 do
   begin
     n:=n-k;
     i:=i+1;
     k:=i*i;
   end;
 write(i);
end.

var s,i,n:longint;
begin
    readln(n); i:=1; s:=0;
    while (n<s) do
    begin
        s:=s+i;
        inc(i);
    end;
    writeln(i);
end.

Var n : longint;
    i,count,j : longint;
    f1,f2 : text;
Begin
 Assign(f1,''); Reset(f1);
 Readln(f1,n);
 i:=0;
 count:=0;
 while j<n do
  Begin
   i:=i+i+1;
   j:=j+i;
   inc(count);
  End;
 Assign(f2,''); Rewrite(f2);
 Writeln(f2,count);
 Close(f2);
End.

program Vanya;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var s,i,n:integer;
begin
  i:=0;
  s:=0;
  readln(n);
  repeat
  i:=i+1;
  s:=s+i;
  n:=n-s;
  until n<s+i;
  writeln(i);
end.

var n:longint;
    m,t,r,l:real;
begin
  readln(n);
  l:=0;
  r:=1000;
  while abs(r-l)>0.01 do
  begin
    m:=(l+r)/2;
    t:=(m*m*m+3*m*m+2*m)/6;
    if t>n then
      r:=m;
    if t<n then
      l:=m;
  end;
  writeln(trunc(m+0.02));
end.

var a,summ,curr,i:Longint;
BEGIN
summ:=0;
read(a);
i:=0;
curr:=0;
while summ+curr<=a do
        begin
                inc(i);
                inc(curr,i);
                inc(summ,curr);
        end;
write(i);
END.

Var
  n, i, cnt: LongInt;
  sum: Int64;
Begin
  ReadLn(n);
  i:=1;
  cnt:=0;
  sum:=1;
  While sum<=n do begin
    i:=i+2;
    sum:=sum+i;
    inc(cnt);
  End;
  WriteLn(cnt-1);
End.

VAr a,b,c,d,u,i,j,n,k,p : longint ;
begin
readln(n);  i:=1 ; p:=3 ;
while n>0 do begin
n:=n-p ;
p:=p+i ;

i:=i+2 ;
k:=k+1 ;
end ;
writeln(k);
writeln(p) ;
end.

var
 n,i,j,x : longint ;

begin
 readln (n) ;
 i := 0 ;
 x := 0 ;
 repeat
  begin
   inc (i) ;
   x := x + i ;
   n := n - x ;
  end;
 until (n < x) ;
 writeln (i);
end.

var
  i,k,n,s: integer;
begin
  Readln(n);
  s := 0;
  i := 0;
  k := 0;
  while s+k+i+1 <= n do begin
    inc(i);
    inc(k,i);
    inc(s,i);
  end;
  writeln(i);
end.

{$MODE OBJFPC}
program onlylove;
var n : int64;
    d ,pre: int64;
    i : integer;
begin
   readln(n);
   d := 0;
   pre:=0;
   for i:=1 to 69 do
      begin

         if pre >= n then
            begin
               Writeln(d);
               halt;
            end;
         inc(d);
         pre:=2*pre+i;
      end;
end.

{$mode objfpc}
var n, i, dem: Integer;

function TCS(x: Integer): Int64;
begin
  Result:= (x*(x+1)) div 2;
end;

begin
  Readln(n);
  If n = 1 then Writeln(1)
  else begin
  i:= 1;
  Repeat
    n:= n - TCS(i);
    Inc(i);
    Inc(dem);
  Until n <= 0;
  Writeln(dem - 1);
  end;
end.

var i,j,k,l,m,n:longint;
begin
readln(n);
i:=0;
m:=0;
while (m<n) do
begin
inc(i);
m:=m+m+i;
end;
writeln(i);
end.

Var n,i:LongInt;
    a,b:array[0..10006] of LongInt;
 Begin
  Read(n);
  for i:=1 to n do
   begin
    a[i]:=a[i-1]+i;
    b[i]:=a[i];
    b[i]:=b[i]+b[i-1];
    if b[i]>n then break;
   end;
  write(i-1);
 end.

var n,x:longint;
    s,s1:int64;
begin
// assign(input,'input.txt');reset(input);
// assign(output,'output.txt');rewrite(output);
 read(n);
 x:=0;
 while s<n do begin
  s1:=s1+x;
  s:=s+s1;
  if (n-s1)>=s1+s1 then
   x:=x+1;
 end;
 writeln(x);
end.

var
i, m, n, t, q : integer;
begin
        read(n);
        m := 1;
        while (n > t)  do
                begin
                m := m + 1;
                t := t +(t + m);
                q := q + 1;
                end;
        write(q);
end.

{$mode objfpc}
var
        i, n: integer;

begin
        readln(N);
        if N <= 0 then begin writeln(0); exit end;
        i := 0;
        while N - i*(i+1) div 2 >= 0 do
        begin
                inc(i);
                dec(N, i*(i+1) div 2);
        end;
        writeln(i);
end.

var n,i:longint;
BEGIN
readln(n);
repeat
inc(i);
until (sqr(i)+i)>(2*n);
write(i-1);
END.

var
 sum:int64;
 x,i:longint;
begin
 read(x);
 i:=1;
 sum:=1;
 while sum<=x do
  begin
   inc(i);
   sum:=sum+i;
  end;
  writeln(i-1);
end.

var n,x:longint;
    s,s1:int64;
begin
// assign(input,'input.txt');reset(input);
// assign(output,'output.txt');rewrite(output);
 read(n);
 x:=0;
 while s<n do begin
  s1:=s1+x;
  s:=s+s1;
  if (n-s1)>=s1+x+1 then
   x:=x+1;
 end;
 writeln(x);
end.

var n,i,s,sum:longint;
begin
read(n);
sum:=0;
for i:=1 to n do
begin
sum:=sum+i*(i+1) div 2;
if sum <= n then s:=i;
end;
writeln(s);
end.

var
  i,k,n: integer;
begin
  Readln(n);
  i := 0;
  k := 0;
  while k+i+1 <= n do begin
    inc(i);
    inc(k,i);
  end;
  writeln(i);
end.

var n,i:longint;
  res:longint;
begin
     read(n);
     i:=1;      res:=0;
     while n>0 do
       begin
           dec(n,i);
           i:=i+2;
           inc(res);
       end;
     if n<0 then  dec(res);
     write(res);
end.

var n:longint;
    m,t,r,l:real;
begin
  readln(n);
  l:=0;
  r:=1000;
  while abs(r-l)>0.01 do
  begin
    m:=(l+r)/2;
    t:=(m*m*m+3*m*m+2*m)/6;
    if t>n then
      r:=m;
    if t<n then
      l:=m;
    writeln('l:',l,'   m:',m);
  end;
  writeln(trunc(m+0.02));
end.

var n,i:longint;
begin
read(n);
for i:=1 to maxlongint do
if ((i+1)*i) div 2>n then begin write(i-1); break; end;
end.

var n,s,i:longint; begin read (n);s:=0; i:=0; while n-s>0 do begin inc(i); s:=s+i; n:=n-s; end; if n<0 then write (i-1); if n=0 then write (i); end.

var
i,n,t,q,s:longint;
begin
read(n);
while s<=n do begin
inc(q);
s:=s+q;
n:=n-s;
inc(t);
end;
write(t);
end.

program easy;
var n,s,i:integer;

begin
  readln(n);
  s:=1;
  i:=1;
  while(s<n)do
    begin
      Inc(i);
      s:=s+Round(i*(i+1)/2);
    end;
  if(s=Round(n*(n+1)/2))then
    write(i)
  else write(i-1);
end.

var i,j,k,l,m,n:longint;
begin
readln(n);
i:=0;
m:=0;
while (m<n) do
begin
inc(i);
m:=m+m+i;
end;
writeln(i);
end.

var i,l,k,n:longint;
begin
readln(n);

while l<=n do
begin
k:=k+1;
i:=i+1;
l:=l+i;
n:=n-l;
end;

writeln(k);

end.

var
  n: integer;
begin
  readln(n);
  writeln(trunc(sqrt(1 + 8*n) - 1));
end.

var
 sum:int64;
 x,i:longint;
begin
 read(x);
 i:=1;
 sum:=1;
 while sum<x do
  begin
   inc(i);
   sum:=sum+i;
  end;
  writeln(i-1);
end.

var n,a,c:longint;
Begin
    read(n);a:=1;c:=1;
    while n-a>0 do
    begin
        inc(c);
        n:=n-a;
        a:=a+c+1;
    end;
    write(c);
End.

var
	n, i: integer;
	count: longint;
begin
	readln(n);
	i:=1;
	while count < n do
		begin
			count:=count * 2 + i;
			i:=i+1;
		end;
	writeln(i - 1);
end.

Var a : array[1..10000]of longint;
    i,j,k,l,n,m,t,c : Longint;
begin
  readln(n);
   While t + i <= n DO
    begin
     inc(i);
     inc(k,round((1 + i) / 2 * i));
     inc(t,k);
    end;
   writeln(i);
end.

Var a : array[1..10000]of longint;
    i,j,k,l,n,m,t,c : Longint;
begin
  readln(n);
   While t < n DO
    begin
     inc(i);
     inc(t,t + i);
    end;
   writeln(i);
end.

const fi='';
      fo='';
var i,n,s:int64;
        f,g:text;
procedure data;
begin
        assign(f,fi); assign(g,fo);
        reset(f); rewrite(g);
        readln(f,n);
end;
procedure process;
begin
        s:=0;
        i:=0;
        while (n>=i) do
        begin
                inc(i);
                inc(s,i);
                dec(n,s);
        end;
        if n<0 then writeln(g,i-1);
        if n=0 then writeln(g,i);
        if n>0 then writeln(g,i+1);

end;
begin
        data;
        process;
        close(g);
end.

var
  i,k,n: integer;
begin
  Readln(n);
  i := 0;
  k := 0;
  while k+i+1 <= 25 do begin
    inc(i);
    inc(k,i);
  end;
  writeln(i);
end.

 var  i,m,n,q:longint;
 begin
  read (n);
  while m<n do
   begin
    i:=i+1;
    q:=q+i;
    m:=m+q;
    end;
   write  (i);
  end.

var
  i,k,n,s: integer;
begin
  Readln(n);
  s := 0;
  i := 0;
  k := 0;
  while s+k+i+1 <= n do begin
    inc(i);
    inc(k,i);
    inc(s,i);
  end;
  writeln(i);
end.

var s,i,n:longint;
begin
    readln(n); i:=1; s:=0; writeln(n);
    while (1=1) do
    begin
        s:=s+i*(i+1) div 2; writeln(s,' ',i);
        if (s>=n) then break else inc(i);
    end;
    if (s>n) then dec(i);
    writeln(i);
end.

var n:longint;
    m,t,r,l:real;
begin
  readln(n);
  l:=0;
  r:=1000;
  while abs(r-l)>0.1 do
  begin
    m:=(l+r)/2;
    t:=(m*m*m+3*m*m+2*m)/6;
    if t>n then
      r:=m;
    if t<n then
      l:=m;
    if t=n then
      break;
  end;
  writeln(trunc(m));
end.

var x,y,z:int64;
begin
read(x);
y:=1;
z:=1;
while x>=y do begin
x:=x-y;
inc(z);
y:=y+z;
writeln(z-1);
end;
end.

const   prob='492A';
var  n,s,i:integer;
begin
  //  assign(input,prob+'.inp'); reset(input);
   // assign(output,prob+'.out'); rewrite(output);
        readln(n);
        s:=1;
        i:=1;
        while(s<n) do
            begin
                inc(i);
                s:=s+i*(i+1) div 2;
                //writeln(i,' ',s);
            end;
        writeln(i-1);
   // close(output);
   // close(input);
end.

var n,i,j,k:longint;
  begin
    read(n);
    i:=1;
    While  k<n do
     begin
      k:=(k*2)+i;
      inc(i);
     end;
    write(i-1);

  end.

var
  i,k,n: integer;
begin
  Readln(n);
  i := 0;
  k := 0;
  while k+i+1 <= n do begin
    inc(i);
    inc(k,i);
  end;
  writeln(i);
end.

VAr a,b,c,d,u,i,j,n,k,p : longint ;
begin
readln(n);  i:=1 ; p:=3 ;
while n>0 do begin
n:=n-p ;
p:=p+i ;

i:=i+2 ;
k:=k+1 ;
end ;
writeln(k);
end.

var ans,h: longint;
    t,s: int64;
begin
    t:=0;
    ans:=1;
    readln(s);
    h:=0;
    while (t<s) do
    begin
        inc(h);
        inc(t,ans);
        inc(ans,2);
    end;
    dec(h);
    if (t>s) then dec(h);
    write(h);
end.

var
 sum:int64;
 x,i:longint;
begin
 read(x);
 i:=2;
 sum:=1;
 while sum<=x do
  begin
   sum:=sum+i;
   inc(i);
  end;
  writeln(i-1);
end.

program taskA;

var
  f, g: text;
  n,i,sum,ans: integer;

begin
  readln(n);

  for i:=1 to 10000 do begin
  sum:=sum*2+i;
  ans:=i;
  if sum+i+1>n then break;
  end;
  writeln(ans);
end.

var
  n,i:longint;
begin
  read(n);
  for i:=n downto 1 do
    if (1+i)*i/2<=n then begin write(i); halt; end;
end.

var
n,q,w,e,o:longint;
begin
read(n);
q:=1;
w:=1;
e:=1;
o:=1;
if n>q
then
while n-(w+q+e)>=0 do
begin
q:=q+e;
inc(e);
w:=w+q;
n:=n-w;
Inc(o);
end;
write(o);
end.

var
        n,i,a,kq:longint;
begin
        readln(n);
        i:=2;
        a:=1;
        while n>=a do
        begin
                dec(n,a);
                inc(kq);
                inc(i);
                inc(a,i);
        end;
        write(kq);
end.

var
a,b,c,d,e,f,g,h,i:integer;
begin
readln(a);
c:=1;
while (b<a) do
begin
for d:=1 to c do
e:=e+d;
b:=b+e;
if (a>b) then
c:=c+1;
if b=a-1 then
c:=c-1;
end;
writeln(c);
readln
end.

program easy;
var n,s,i:integer;

begin
  readln(n);
  s:=1;
  i:=1;
  while(s<n)do
    begin
      Inc(i);
      s:=s+Round(i*(i+1)/2);
    end;
  if(s=Round(n*(n+1)/2))then
    write(i)
  else write(i-1);
end.

var n,i,j:longint;
begin
	readln(n);
	i:=0;
	j:=1;
	while n>=j do
	begin
		inc(i);
		dec(n,j);
		inc(j,2);
	end;
	writeln(i);
end.

var n,x:longint;
    s,s1:int64;
begin
// assign(input,'input.txt');reset(input);
// assign(output,'output.txt');rewrite(output);
 read(n);
 x:=1;
 while s<n do begin
  s1:=s1+x;
  s:=s+s1;
  if (n-s1)>=s1+s1 then
  x:=x+1;
 end;
 writeln(x);
end.

var n,a:longint;ans,i:integer;
begin
 readln(n);
 if n = 1 then writeln('1')
          else begin
                a:=1;
                ans:=1;
                while (a<=n) do
                      begin
                       inc(ans);
                       a:=a+(a+ans);
                      end;

                if a = n+1 then writeln(ans)
                         else writeln(ans-1);
               end;

end.

program z1;
 var n,m,i:longint;
function f1(a,r,k:longint):longint;
begin
 writeln(r,' ',a);
 if(a+k>m)
  then f1:=r
  else f1:=f1(a+k,r+1,k+r+2);
end;
begin
 readln(m);
 writeln(f1(0,0,1));
end.

var n: int64;
    i, j: longint;
begin
  n:=0;
  readln(j);
  for i:=1 to j do n:=n+i;
  write(n);
end.

VAr a,b,c,d,u,i,j,n,k,p : longint ;
begin
readln(n);  i:=1 ; p:=3 ;
while n>0 do begin
n:=n-p ;
p:=p+i ;

i:=i+2 ;
k:=k+1 ;
end ;
writeln(k);
writeln(p) ;
end.

program z1;
var n,i,k,br:longint;
begin
read(n);
i:=1;
while n-i>=0  do
        begin
          k:=k+i;
          n:=n-k;
          i:=i+1;
          br:=br+1;
        end;
writeln(br);
end.

{$MODE OBJFPC}
const
        fi = '';
        fo = '';

var
        f1,f2         :Text;
        n             :Integer;
        s,f           :array[1..100000] of Integer;

procedure Input;
var
        i       :Integer;
begin
        readln(f1,n);
        s[1]:=1;
        for i:=2 to 50 do s[i]:=s[i-1]+i;
        for i:=2 to 50 do f[i]:=f[i-1]+s[i];
        for i:=1 to 20 do
                if f[i]>n then Break;
        Writeln(i-1);
end;

BEGIN
        assign(f1,fi);reset(f1);
        assign(f2,fo);rewrite(f2);
        Input;
        close(f1);close(f2);
END.

{$mode objfpc}
var n, i, dem: Integer;

function TCS(x: Integer): Integer;
begin
  Result:= (x*(x+1)) div 2;
end;

begin
  Readln(n);
  i:= 1;
  Repeat
    n:= n - TCS(i);
    Inc(i);
    Inc(dem);
  Until n = 0;
  Writeln(dem);
end.

var a,n,t:integer;
begin
a:=1;
t:=1;
readln(n);
while a*2+2<=n do
 begin
 inc(t);
 a:=a*2+2;
 end;
writeln(t);
end.

var n,a:longint;ans,i:integer;
begin
 readln(n);
 if n = 1 then ans:=1
          else begin
                a:=1;
                ans:=1;
                while (a<=n) do
                      begin
                       inc(ans);
                       a:=a+(a+ans);
                      end;
                      writeln(a);
                if a = n+1 then writeln(ans)
                         else writeln(ans-1);
               end;

end.

var n,x1:longint;
x:real;
begin
readln(n);
x:=((-1 + sqrt(1+4*2*n)) / 2) ;
x1:=trunc(x);
Writeln(x1);
end.

var a,n,h,i:real;
begin
readln(n);
while a<=n do begin h:=h+1;
a:=a+(h*(h+1))/2;
end;
write(h-1);
end.


On one of the planets of Solar system, in Atmosphere University, many students are fans of bingo game.It is well known that one month on this planet consists of $$$n^2$$$ days, so calendars, represented as square matrix $$$n$$$ by $$$n$$$ are extremely popular.Weather conditions are even more unusual. Due to the unique composition of the atmosphere, when interacting with sunlight, every day sky takes one of three colors: blue, green or red.To play the bingo, you need to observe the sky for one month — after each day, its cell is painted with the color of the sky in that day, that is, blue, green or red.At the end of the month, students examine the calendar. If at least one row or column contains only cells of one color, that month is called lucky.Let's call two colorings of calendar different, if at least one cell has different colors in them. It is easy to see that there are $$$3^{n \cdot n}$$$ different colorings. How much of them are lucky? Since this number can be quite large, print it modulo $$$998244353$$$.

The first and only line of input contains a single integer $$$n$$$ ($$$1 \le n \le 1000\,000$$$) — the number of rows and columns in the calendar.

Print one number — number of lucky colorings of the calendar modulo $$$998244353$$$

NoteIn the first sample any coloring is lucky, since the only column contains cells of only one color.In the second sample, there are a lot of lucky colorings, in particular, the following colorings are lucky:  While these colorings are not lucky:

              const eps=0.00000001;  besk1=200000008;  nn=600000;
             { modul=1000000007;  }
   besk=8000000000000000000;
   label 22,1,2,3,4;
    type    real=extended;   double=extended;
    mas=array [-10..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of longint;mass1=^mass;
    var pp1,diam,modul,oldt,ot1,time,pos,prod,ll,rr,posx,posy,gr,n,dloch,newdl,oldn,oldm,ost,ot,aa,bb,cc,p1,p2,p3,p4,kk,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,x0,p0,t2,t1,jj,w,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,pmax,imax,t,nm,m,smin,cen:int64;
   mask,k,i1,j1,step1, step, i,j:longint;
   y:mas;
    ppp,prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    oldpos,finot,vv,znak:int64;
    a,aold:mas;
    px,py,xc,yc,xxc,yyc:extended;
    poss:array[-1..500001,-1..50] of longint;
    z1,z2,fact,next,prev,x,xx,yy,str,kol,s,name,d,dnew, voltay,l,r,c,z,day,b:array[-300000..2600000] of int64;
    zz:array[0..125000000] of byte;
    ppole:array[-10..1002,-10..1005] of char;
    pole,ddd,dd1,dd2,dd3,dd4,dd,ddsum:array[-10..1201,-10..1220] of int64;
   newzan,marked,zanx,zany:array[-10..2000000] of boolean;
    sss1,sss2:string;
    invfact,udal,stepen,koled,def,mindef,dl,och,newoch,place,newnabor,stoim,nabor:array[-10..2000005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
    ss1,ss2,ss:string;ch,ch1,ch2:char;
    binkoef,right,left,numleft,numright,dr: array [-10..60,-10..60] of int64;
    s3,s2,s1:array[-100..200000] of string;

    grr :array [-10..2010,-10..2010] of boolean;
    maxpr:array[0..nn] of string;
    sss:array[-10..nn] of string;
     tx,ty,vel,x1,y1,ott,v0,v1,s0,t0:int64;
     zv:point;
     ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     sq,sqx,sqy,ottt,aaa,bbb,ccc:extended;
     xxx,yyy,yot:double;
       flag2,flag,flag1:boolean;

  function max(a,b:int64):int64;
begin max:=a; if b>a then max:=b;   end;

  function min(a,b:int64):int64;
begin min:=a; if b<a then min:=b;   end;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

{     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;
 }

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

{function prost(tt:longint):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then fl:=false;

   prost:=fl;
 end;
 }
function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

function koef(n,k:longint):int64;
var ot,p1,p2,p3:int64;
begin
p1:=fact[n];
p2:=invfact[k];
p3:=invfact[n-k];
ot:=(p1*p2 mod modul)*p3 mod modul;
koef:=ot;
end;

function ff(i,j:longint):longint;
begin
   if i*j=0 then ff:=x[i+j+n*(n-i-j)] else
   ff:=x[1+(n-i)*(n-j)];

end;

begin

   { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }

     modul:=998244353;
     readln(n);
     fact[0]:=1;   invfact[0]:=1;
     pp:=degg(3,n);
     pp1:=degg(pp,modul-2);
     z1[0]:=1;  for i:=1 to n do z1[i]:=z1[i-1]*pp mod modul;
     z2[0]:=1;  for i:=1 to n do z2[i]:=z2[i-1]*pp1 mod modul;

     for i:=1 to   n do begin ii:=i; fact[i]:=fact[i-1]*ii mod modul; invfact[i]:=degg(fact[i],modul-2);  end;
    { for i:=0 to n do writeln(fact[i],' ++ ',invfact[i]);
    } x[0]:=1; for i:=1 to n do x[i]:=(x[i-1]*3) mod modul;
     ot:=0;
     for i:=0 to n do z[i]:=koef(n,i);
       for i:=0 to n-1 do
         begin
           p1:=z[i];
           ii:=i;
           t:=(1-x[i]+modul) mod modul;
           tt:=degg(t,n);
          { t1:=degg(3,ii*n); } t1:=z1[i];
           if  odd(n) then p2:=p1*(tt+t1+modul) mod modul else p2:=p1*(tt-t1+modul) mod modul;
        {   writeln('i= ',i,' tt= ',tt,'   t1= ',t1,'  p2= ' ,p2);
        }   if odd(i) then ot:=ot+p2 else ot:=ot-p2;

         end;
        ot:=(3*ot+1000*modul) mod modul;
       { writeln('ot= ',ot);
       }     ot1:=0;
        for i:=1 to n do
          begin
              ii:=i;
             p1:=z[i];
             p2:=degg(3,ii+n*(n-ii)); {p2:=z1[i]*z2[i]*degg(3,n*n); }
          {   writeln('i= ', i,' p1= ',p1,' p2= ',p2);
          }   if odd(i) then ot1:=(ot1+(p1*p2)) mod modul else ot1:=(ot1-(p1*p2)+1000000000*modul) mod modul;

          end;

        {  writeln(2*ot1);
         }
         writeln((2*ot1+ot) mod modul);
          goto 1;
        ot:=0;
        for i:=0 to n do for j:=0 to n do if(i+j>0) then
          begin
         p:=(koef(n,i)*koef(n,j)) mod modul *ff(i,j) mod modul;

          {  writeln(' i= ',i,' j= ',j,' p= ',p);
          }  if odd(i+j) then ot:=(ot+p) mod modul else ot:=(ot-p+modul) mod modul;
          end;
      writeln(ot);

   1:          close(output);
end.


Polycarp has a cat and his cat is a real gourmet! Dependent on a day of the week he eats certain type of food:  on Mondays, Thursdays and Sundays he eats fish food;  on Tuesdays and Saturdays he eats rabbit stew;  on other days of week he eats chicken stake. Polycarp plans to go on a trip and already packed his backpack. His backpack contains:  $$$a$$$ daily rations of fish food;  $$$b$$$ daily rations of rabbit stew;  $$$c$$$ daily rations of chicken stakes. Polycarp has to choose such day of the week to start his trip that his cat can eat without additional food purchases as long as possible. Print the maximum number of days the cat can eat in a trip without additional food purchases, if Polycarp chooses the day of the week to start his trip optimally.

The first line of the input contains three positive integers $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \le a, b, c \le 7\cdot10^8$$$) — the number of daily rations of fish food, rabbit stew and chicken stakes in Polycarps backpack correspondingly.

NoteIn the first example the best day for start of the trip is Sunday. In this case, during Sunday and Monday the cat will eat fish food, during Tuesday — rabbit stew and during Wednesday — chicken stake. So, after four days of the trip all food will be eaten.In the second example Polycarp can start his trip in any day of the week. In any case there are food supplies only for one week in Polycarps backpack.In the third example Polycarp can start his trip in any day, excluding Wednesday, Saturday and Sunday. In this case, the cat will eat three different dishes in three days. Nevertheless that after three days of a trip there will be $$$99$$$ portions of rabbit stew in a backpack, can cannot eat anything in fourth day of a trip.

var x,y,z,a,b,c,s,k,i,j:int64;
begin
 read(a,b,c);
 x:=a div 3;
 y:=b div 2;
 z:= c div 2;
 s:=0;
 s:=7*min(min(x,y),z);
 a:=a - 3 * min(min(x,y),z);
 b:=b - 2*min(min(x,y),z);
 c:=c-2*min(min(x,y),z);
 k:=0;
 for i:=1 to 7 do
  begin
  j:=i;
  x:=a;
  y:=b;
  z:=c;
   while (x > -1) and (y > -1) and (z > -1) do
    begin
     if (j mod 7 = 1) or (j mod 7 = 4) or (j mod 7 = 0) then
      x:=x-1;
     if (j mod 7 = 2) or (j mod 7 = 6) then
      y:=y-1;
     if (j mod 7 = 3) or (j mod 7 = 5) then
      z:=z-1;
     j:=j+1;
    end;
   if k < j-1-i  then
    k:=j - 1-  i;
  end;
 writeln(s+k);

end.

var min,maxp,ba,bb,bc,max,j,backup,i,a,b,c,ans,ty:integer;
begin
read(a,b,c);

ba:=a div 3;
bb:=b div 2;
bc:=c div 2;

if (ba <= bb) and (ba <= bc) then
 min:=ba;
if (bb <= ba) and (bb <= bc) then
 min:=bb;
if (bc <= ba) and (bc <= bb) then
 min:=bc;

a:=a - min*3;
b:=b - min*2;
c:=c - min*2;
inc(ans,min*7);

max:=0;
ba:=a;
bb:=b;
bc:=c;
i:=0;
for j:=1 to 7 do begin
 a:=ba;
 b:=bb;
 c:=bc;
 maxp:=0;
 i:=j;
 for ty:=1 to 7 do begin
  if (i = 1) or (i = 4) or (i = 7) then
   if (a > 0) then begin
    inc(maxp);
    dec(a);
   end
   else
    break;
  if (i = 2) or (i = 6) then
   if (b > 0) then begin
    inc(maxp);
    dec(b);
   end
   else
    break;
  if (i = 3) or (i = 5) then
   if (c > 0) then begin
    inc(maxp);
    dec(c);
   end
   else
    break;
  inc(i);
  if (i = 8) then
   i:=1;
 end;
 if (maxp > max) then
  max:=maxp;
end;

inc(ans,max);
writeln(ans);
end.

program Project_C;

var
  a, b, c, x, j, max, a1, b1, c1: int64;
  i: longint;

begin
  read(a, b, c);
  x := a div 3;
  if (b div 2) < x then
    x := b div 2;
  if (c div 2) < x then
    x := c div 2;

  a := a - 3 * x;
  b := b - 2 * x;
  c := c - 2 * x;

  max := 0;
  a1 := a;
  b1 := b;
  c1 := c;
  for i := 1 to 7 do begin
    j := i;
    a := a1;
    b := b1;
    c := c1;
    while (j < i + 7) do begin
      if (j = 1) or (j = 4) or (j = 7) or (j = 8) or (j = 11) or (j = 14) then begin
        if a > 0 then begin
          dec(a);
          inc(j);
        end else
          break;
      end else if (j = 2) or (j = 6) or (j = 9) or (j = 13) then begin
        if b > 0 then begin
          dec(b);
          inc(j);
        end else
          break;
      end else begin
        if c > 0 then begin
          dec(c);
          inc(j);
        end else
          break;
      end;
    end;
    if j - i > max then
      max := j - i;
  end;

  write(7 * x + max);

end.

                                          const eps=1e-10;
      besk=4000000000000000000; label 1,3,2,44;
type mas=array[-10000..550000+1] of int64; integer=longint;
var dl,len,i1,j1,mask,stepp,h,n2,i,j,k,l,step,k1,w,mesto,num:longint;
ss,ss1:string;
pos,dx,dy,ll,rr,sum,m,start,finish,time,p3,p4,jj,qqq,ii,tt,pmax,pmax2,qq,p1,p2,ot,ott,hh,pos0,pos1,pos2,pp,mm,maxot,mnog,tmax,summax,n,nn,kk,modul,t0,t1,n1,t2,q,t,p:int64; flag1:boolean;
  summ,place,kol,str,a2,b2,left,right,zz,z1,sum1,sum0,d0,d1,ccc,c,d,a,b:mas; flag2,flag:boolean;  pl:longint;
 razr,jmax,maxx, gr,grr,ener,dob,aa,bb,cc,dist,tt3,tt1,tt2,ugg,aa1,aa2,r,ug:int64;
  marked,zan:array[-10..1000000] of boolean;
  predok,a1,b1,strok:array[-10..550000] of int64;
  stroka:array[-1000..1000000] of char;
  ot1,otmax,v:extended;
  sp,sss:array[-10..2000000] of string;
  newpole,dd,pole:array[-100..1210,-1..1210] of int64;
  dchet,dnech,poschet,posnechet:array[-10..290000,-1..30] of int64;
  poss:int64;
  ch:char;
  flagg1:boolean;
  ymax,ymin,xmax,xmin,znach,z,nomer,newplace,newstr,s,next,prev,xx,yy,aold,x,y:array[-100000..2000002] of int64;
  ddd:array[-10..5010,-10..5010] of int64;
 function srav(i,j:longint):boolean;
  begin if (a[i]<a[j])or(a[i]=a[j])and(a1[i]<a1[j])or(a[i]=a[j])and(a1[i]=a1[j])and(a2[i]<a2[j])  then
  srav:=true else srav:=false; end;

procedure sl (k,l,m:integer);  {k- dlina, l,m - nachalo dvuh blokov}
begin
i:=l;j:=m; flag:=true; step:=0;while flag do begin
if (srav(i,j)) then begin begin b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];end;
inc(step);inc(i);
{writeln('step=',step,' i=',i);} end;
if (not srav(i,j)) then begin begin b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];end;
inc(step);inc(j);end;
if  ((i>=l+k) or (j>=m+k)) then flag:=false;
end;
if(i>=l+k) then repeat b[l+step]:=a[j];b1[l+step]:=a1[j];b2[l+step]:=a2[j];inc(step);inc(j);until (j>=m+k);
if(j>=m+k) then repeat b[l+step]:=a[i];b1[l+step]:=a1[i];b2[l+step]:=a2[i];inc(step);inc(i);until (i>=l+k);
end;
procedure sort(var c:mas);

begin

k:=1; repeat
l:=1;m:=k+l; repeat sl(k,l,m); l:=l+2*k;m:=m+2*k; until (l>=n); k:=k*2;
for i:=1 to n do begin a[i]:=b[i];a1[i]:=b1[i];a2[i]:=b2[i]; end;
until (k>=n);

end;

function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

function phi(a,b:double):double; label 222;var p:double;
begin
  if (a>0)and (b>=0) then begin p:=arctan(b/a);goto 222; end;
  if (a<0) then begin p:=pi+arctan(b/a);goto 222; end;
  if (a>0)and (b<0) then begin p:=2*pi+arctan(b/a);goto 222; end;
  if (a=0)and (b>0) then begin p:=pi/2;goto 222; end;
  if (a=0)and (b<0) then begin p:=3*pi/2;goto 222; end;
  222: phi:=p;
end;

function nod(a,b:int64):int64; var p,t:int64;
begin
  a:=abs(a); b:=abs(b);
  if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

function nok(a,b:int64):int64;
begin  nok:=(a*b) div nod(a,b);  end;

   function degg(a:int64;k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=(degg(a,k-1)*a) mod modul  else
   begin  p:=degg(a,k div 2); degg:=(p*p) mod modul;    end;

end;

procedure udal(ii:longint);
begin  next[prev[ii]]:=next[ii];prev[next[ii]]:=prev[ii];  end;

function nomerr(gr:int64):int64;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=p;  cc:=aa; fl:=false;
  while abs(aa-bb)>1 do
    begin
       cc:=(aa+bb) shr 1;
     {  writeln('cc=++ ',cc);
     }  if y[cc]<gr then aa:=cc else bb:=cc;

    end;
  { writeln(' cc= ',cc);
  } cc:=max(cc-3,0);
   repeat inc(cc) until y[cc]>=gr;
   if y[cc]=gr then fl:=true else fl:=false;
   { if fl then nomerr:=a1[cc] else nomerr:=-1000;}
   nomerr:=cc;
end;

function prost(pp:longint):boolean;
var i,j,t:longint; tt:extended; fl:boolean;
begin
  tt:=pp;
  tt:=sqrt(tt);
  fl:=true;
  for i:=2 to round(tt) do if pp mod i=0 then  fl:=false;

 prost:=fl;

end;

function day1(time:int64):int64;
var p,pp,ot:int64;
begin
   ot:=time div 7*3;
   p:=time mod 7;
   if p>=6 then ot:=ot+1;
   if p>=3 then ot:=ot+1;
   if p>=0 then ot:=ot+1;
   if time<0 then ot:=0;
   day1:=ot;
end;

function day2(time:int64):int64;
var p,pp,ot:int64;
begin
   ot:=time div 7*2;
   p:=time mod 7;
   if p>=5 then ot:=ot+1;
   if p>=1 then ot:=ot+1;
   if time<0 then ot:=0;
   day2:=ot;
end;

function day3(time:int64):int64;
var p,pp,ot:int64;
begin
   ot:=time div 7*2;
   p:=time mod 7;
   if p>=2 then ot:=ot+1;
   if p>=4 then ot:=ot+1;
   if time<0 then ot:=0;
   day3:=ot;
end;

function good(daystart,dayfinish,p1,p2,p3:int64):boolean;
var ot,t1,t2,t3,tt1,tt2,tt3:int64; fl:boolean;
begin
   fl:=true;
   t1:=day1(dayfinish)-day1(daystart-1);
   t2:=day2(dayfinish)-day2(daystart-1);
   t3:=day3(dayfinish)-day3(daystart-1);
   if t1>p1 then fl:=false;
   if t2>p2 then fl:=false;
   if t3>p3 then fl:=false;

   good:=fl;

end;

begin

 {  assign (input,'D:\Projects\input.txt');reset(input);
   assign (output,'D:\Projects\output.txt'); rewrite(output);
  }

   for i:=1 to 3 do read(x[i]);

   pp:=besk;

   pp:=min(pp,x[1] div 3*7);
   pp:=min(pp,x[2] div 2*7);
   pp:=min(pp,x[3] div 2*7);

   if pp<1000 then
      begin
         for i:=0 to 6 do for j:=i to 2000 do
           begin
              if good(i,j,x[1],x[2],x[3]) then ot:=max(ot,j-i+1);

           end;

      end  else
      begin
         x[1]:=x[1]-pp div 7*3+3*3;
         x[2]:=x[2]-pp div 7*2+2*3;
         x[3]:=x[3]-pp div 7*2+2*3;
       {  for i:=1 to 3 do write(x[i],'  * '); writeln;
       }
         for i:=0 to 1000 do for j:=i to 1000 do
           begin
              if good(i,j,x[1],x[2],x[3]) then ot:=max(ot,j-i+pp-21+1);

           end;

      end;

   writeln(ot);

 1: close (output);
     end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='c';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(nn,mm,kk);
  u:=mn(nn div 3,mn(mm div 2,kk div 2));
  res:=7*u;
  dec(nn,3*u);
  dec(mm,2*u);
  dec(kk,2*u);
  cur:=0;
  for k:=0 to 6 do
    begin
    i:=k; q0:=nn; q1:=mm; q2:=kk;
    ii:=-1;
    while ((q0>=0)and(q1>=0)and(q2>=0)) do
      begin
      if i mod 7=0 then dec(q0);
      if i mod 7=1 then dec(q1);
      if i mod 7=2 then dec(q2);
      if i mod 7=3 then dec(q0);
      if i mod 7=4 then dec(q2);
      if i mod 7=5 then dec(q1);
      if i mod 7=6 then dec(q0);
      i:=(i+1) mod 7;
      inc(ii);
      end;
    if cur<ii then cur:=ii;
    end;
  writeln(res+cur);
  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

var a,b,c,kol,k,max,i:longint;m:array[1..3]of longint;
function ky(i,a,b,c:longint):longint;
var j,k:longint;
begin
  k:=0;
  for j:=i to 7 do
    if (j in [1,4,7])and(a>0) then
      begin
      dec(a);
      inc(k);
      end
    else if (j in [2,6])and(b>0) then
      begin
      dec(b);
      inc(k);
      end
    else if (j in [3,5])and(c>0) then
      begin
      dec(c);
      inc(k);
      end
    else
      begin
      ky:=k;
      exit;
      end;
  for j:=1 to i-1 do
    if (j in [1,4,7])and(a>0) then
      begin
      dec(a);
      inc(k);
      end
    else if (j in [2,6])and(b>0) then
      begin
      dec(b);
      inc(k);
      end
    else if (j in [3,5])and(c>0) then
      begin
      dec(c);
      inc(k);
      end
    else
      begin
      ky:=k;
      exit;
      end;
end;
begin
  read(a);
  read(b);
  read(c);
  m[1]:=a div 3;
  m[2]:=b div 2;
  m[3]:=c div 2;
  kol:=m[1];
  if m[2]<kol then kol:=m[2];
  if m[3]<kol then kol:=m[3];
  a:=a - 3*kol;
  b:=b - 2*kol;
  c:=c - 2*kol;
  kol:=kol*7;
  max:=ky(1,a,b,c);
  for i:=2 to 7 do
    begin
    k:=ky(i,a,b,c);
    if k>max then max:=k;
    end;
  kol:=kol+max;
  writeln(kol);
end.

program c1154;

var
  a, b, c: longword;
  a1, b1, c1: longword;
  a2, b2, c2: longword;
  min_weeks, max_length, current_length, i, j: longword;
  days: array[1..7] of char;
begin
  days[1] := 'a';
  days[2] := 'b';
  days[3] := 'c';
  days[4] := 'a';
  days[5] := 'c';
  days[6] := 'b';
  days[7] := 'a';

  readln(a,b,c);
  min_weeks := (c div 2);
  if (b div 2) < min_weeks then
    min_weeks := (b div 2);
  if (a div 3) < min_weeks then
    min_weeks := (a div 3);

  a1 := a - min_weeks*3;
  b1 := b - min_weeks*2;
  c1 := c - min_weeks*2;

  // we calcualted number of full weeks
  // now we need to calculate remainder
  max_length := 0;
  for i := 1 to 7 do begin
    j := i;
    current_length := 0;
    a2 := a1; b2 := b1; c2 := c1;
    while true do begin
      if days[j mod 8] = 'a' then
        if a2 > 0 then begin
          inc(current_length);
          dec(a2);
        end else
          break;

      if days[j mod 8] = 'b' then
        if b2 > 0 then begin
          inc(current_length);
          dec(b2);
        end else
          break;

      if days[j mod 8] = 'c' then
        if c2 > 0 then begin
          inc(current_length);
          dec(c2);
        end else
          break;

      inc(j);
    end;

    if current_length > max_length then
      max_length := current_length;
  end;

  writeln(min_weeks*7+max_length);
end.

const fi='';
var f:text;
i,j:longint;
a,b,c,a1,b1,c1,n,k,m,s,d,t:int64;
begin
        assign(f,fi);
        reset(f);
        read(f,a,b,c);
        close(f);

        a1:=a div 3;
        b1:=b div 2;
        c1:=c div 2;

        s:=1000000000;

        if s>a1 then s:=a1;
        if s>b1 then s:=b1;
        if s>c1 then s:=c1;

        s:=7*s;
        k:=0;

        for i:=1 to 7 do
        begin
                a1:=a-3*(s div 7);
                b1:=b-2*(s div 7);
                c1:=c-2*(s div 7);
                for j:=i to 6+i do
                begin
                        t:=0;
                        if (j mod 7=1) or (j mod 7=2) or (j mod 7=5) then
                        if a1>0 then
                        begin
                                dec(a1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=3) or (j mod 7=0) then
                        if b1>0 then
                        begin
                                dec(b1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=4) or (j mod 7=6) then
                        if c1>0 then
                        begin
                                dec(c1);
                                inc(d);
                                t:=1;
                        end;
                        if t=0 then break;
                end;
                if k<d then k:=d;
                d:=0;
        end;

        write(s+k);
end.

var a,b,c:longint;
i,j:longint;
T:ARRAY [2..8] OF LONGINT;
FUNCTION MAX(AA,BB:LONGINT):LONGINT;
BEGIN
        IF AA>BB THEN MAX:=AA ELSE MAX:=BB;
END;
FUNCTION MIN(AA,BB:LONGINT):LONGINT;
BEGIN
        IF AA>BB THEN MIN:=BB ELSE MIN:=AA;
END;
FUNCTION LAST(Q:LONGINT):INT64;
VAR I,J:LONGINT;
        A1,B1,C1:LONGINT;
BEGIN
        A1:=A;
        B1:=B;
        C1:=C;
        I:=0;
        J:=Q;
        WHILE (A1>=0) AND (B1>=0) AND (C1>=0) DO
        BEGIN
                IF  T[J]=1 THEN DEC(A1);
                IF T[J]=2 THEN DEC(B1);
                IF T[J]=3 THEN DEC(C1);
                I:=I+1;
                J:=J+1;
                IF J>8 THEN J:=2;
        END;
        LAST:=I-1;
END;
PROCEDURE THAMLAM;
VAR I,J:LONGINT;
        SL,SN:INT64;
BEGIN
        SL:=MIN(A DIV 3,MIN(B DIV 2,C DIV 2));
        A:=A-SL*3;
        B:=B-SL*2;
        C:=C-SL*2;
        SN:=0;
        FOR I:=2 TO 8 DO
        BEGIN
                SN:=MAX(SN,SL*7+LAST(I));
        END;
        WRITELN(SN);
END;
BEGIN
        T[2]:=1;
        T[3]:=2;
        T[4]:=3;
        T[5]:=1;
        T[6]:=3;
        T[7]:=2;
        T[8]:=1;
        READLN(A,B,C);
        THAMLAM;
END.

var x,y,z,a,b,c,s,k,i,j:int64;
begin
 read(a,b,c);
 x:=a div 3;
 y:=b div 2;
 z:= c div 2;
 s:=0;
 s:=7*min(min(x,y),z);
 a:=a - 3 * min(min(x,y),z);
 b:=b - 2*min(min(x,y),z);
 c:=c-2*min(min(x,y),z);
 k:=0;
 for i:=1 to 7 do
  begin
  j:=i;
  x:=a;
  y:=b;
  z:=c;
   while (x > -1) and (y > -1) and (z > -1) do
    begin
     if (j mod 7 = 1) or (j mod 7 = 4) or (j mod 7 = 0) then
      x:=x-1;
     if (j mod 7 = 2) or (j mod 7 = 6) then
      y:=y-1;
     if (j mod 7 = 3) or (j mod 7 = 5) then
      z:=z-1;
     j:=j+1;
    end;
   if k < j-1-i  then
    k:=j - 1 +  i;
  end;
 writeln(s+k);

end.

const fi='';
var f:text;
i,j:longint;
a,b,c,a1,b1,c1,n,k,m,s,d,t:int64;
begin
        assign(f,fi);
        reset(f);
        read(f,a,b,c);
        close(f);

        a1:=a div 3;
        b1:=b div 2;
        c1:=c div 2;

        s:=100000000;

        if s>a1 then s:=a1;
        if s>b1 then s:=b1;
        if s>c1 then s:=c1;

        s:=7*s;
        k:=0;

        for i:=1 to 7 do
        begin
                a1:=a-3*(s div 7);
                b1:=b-2*(s div 7);
                c1:=c-2*(s div 7);
                for j:=i to 6+i do
                begin
                        t:=0;
                        if (j mod 7=1) or (j mod 7=2) or (j mod 7=5) then
                        if a1>0 then
                        begin
                                dec(a1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=3) or (j mod 7=0) then
                        if b1>0 then
                        begin
                                dec(b1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=4) or (j mod 7=6) then
                        if c1>0 then
                        begin
                                dec(c1);
                                inc(d);
                                t:=1;
                        end;
                        if t=0 then break;
                end;
                if k<d then k:=d;
                d:=0;
        end;

        write(s+k);
end.

const fi='';
var f:text;
i,j:longint;
a,b,c,a1,b1,c1,n,k,m,s,d,t:int64;
begin
        assign(f,fi);
        reset(f);
        read(f,a,b,c);
        close(f);

        a1:=a div 3;
        b1:=b div 2;
        c1:=c div 2;

        s:=100;

        if s>a1 then s:=a1;
        if s>b1 then s:=b1;
        if s>c1 then s:=c1;

        s:=7*s;
        k:=0;

        for i:=1 to 7 do
        begin
                a1:=a-3*(s div 7);
                b1:=b-2*(s div 7);
                c1:=c-2*(s div 7);
                for j:=i to 6+i do
                begin
                        t:=0;
                        if (j mod 7=1) or (j mod 7=2) or (j mod 7=5) then
                        if a1>0 then
                        begin
                                dec(a1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=3) or (j mod 7=0) then
                        if b1>0 then
                        begin
                                dec(b1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=4) or (j mod 7=6) then
                        if c1>0 then
                        begin
                                dec(c1);
                                inc(d);
                                t:=1;
                        end;
                        if t=0 then break;
                end;
                if k<d then k:=d;
                d:=0;
        end;

        write(s+k);
end.

const fi='';
var f:text;
a,b,c,a1,b1,c1,i,j,n,k,m,s,d,t:longint;
begin
        assign(f,fi);
        reset(f);
        read(f,a,b,c);
        close(f);

        a1:=a div 3;
        b1:=b div 2;
        c1:=c div 2;

        s:=100;

        if s>a1 then s:=a1;
        if s>b1 then s:=b1;
        if s>c1 then s:=c1;

        s:=7*s;
        k:=0;

        for i:=1 to 7 do
        begin
                a1:=a-3*(s div 7);
                b1:=b-2*(s div 7);
                c1:=c-2*(s div 7);
                for j:=i to 6+i do
                begin
                        t:=0;
                        if (j mod 7=1) or (j mod 7=2) or (j mod 7=5) then
                        if a1>0 then
                        begin
                                dec(a1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=3) or (j mod 7=0) then
                        if b1>0 then
                        begin
                                dec(b1);
                                inc(d);
                                t:=1;
                        end;
                        if (j mod 7=4) or (j mod 7=6) then
                        if c1>0 then
                        begin
                                dec(c1);
                                inc(d);
                                t:=1;
                        end;
                        if t=0 then break;
                end;
                if k<d then k:=d;
                d:=0;
        end;

        write(s+k);
end.


You are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be  of them.You want to draw these segments in several layers so that in each layer the segments don't overlap (they might touch at the endpoints though). You can not move the segments to a different location on the coordinate axis. Find the minimal number of layers you have to use for the given N.

The only input line contains a single integer N (1 ≤ N ≤ 100).

Output a single integer - the minimal number of layers required to draw the segments for the given N.

NoteAs an example, here are the segments and their optimal arrangement into layers for N = 4.

program zzz;
var
  n,res:longint;
  resr:real;
begin
  readln(n);
  resr:=((n/2)+1)*(n/2);
  if resr-trunc(resr) <>0 then res:=trunc(resr) +1
                    else res:=trunc(resr);
  write(res);
end.

var n:longint;
begin
 read(N);
 write((n div 2+1)*(n div 2 + n mod 2));
end.

var
n:longint;
begin
readln(n);
writeln(trunc(sqr((n+1)/2)):5);
end.

var n:longint;
begin
  readln(n);
  write(trunc(sqr((n+1)/2)));
end.

var
 n:longint;
begin
 read(n);
 write(trunc(sqr((n+1)/2)));
end.

var
 l,r,n:longint;
begin
  readln(n);
  l:=n div 2;
  r:=l;
  if odd(n) then inc(r);
  writeln((l+1)*r);
end.

var n:longint;
begin
  readln(n);
  if n mod 2=1 then
    writeln(sqr((n+1) div 2))
  else
    writeln((sqr(n div 2)+sqr(n div 2+1)) div 2);
end.

var
 n,i:longint;
 a:array[0..101] of int64;
begin
 readln(n);
 a[1]:=1; a[2]:=2; a[3]:=4; a[4]:=6;
 if n in [1..4] then writeln(a[n])
  else
   begin
    for i:=5 to n do
     a[i]:=(2*a[i-1])-(2*a[i-3])+a[i-4];
    writeln(a[n]);
   end;
end.

var a:array[0..10000] of longint;
i,n:longint;
begin
//assign(input,'xf.in');reset(input);
//assign(output,'xf.out');rewrite(output);
readln(n);a[1]:=1;
for i:=2 to n do
  a[i]:=a[i-1]+(i+1) div 2;
writeln(a[n]);
close(input);close(output);
end.

var n,i:longint;
f:array[1..100] of longint;

begin
//assign(input,'xf.in');reset(input);
//assign(output,'xf.out');rewrite(output);
read(n);
f[1]:=1;
f[2]:=2;
for i:=3 to n do
  f[i]:=f[i-2]+i;
write(f[n]);
close(input);
close(output);
end.

var
  n, i, j, ans : longint;
begin
  readln( n );
  for i := 1 to ( n + 1 ) div 2 do
    begin
      for j := i to n - i + 1 do
        inc( ans );
    end;
  writeln( ans );
end.

var
 n:longint;
begin
  readln(n);
  write(trunc(sqr((n+1)/2)):5);
end.

var
a:array[1..100000] of qword;
i,j,c,d,e,b,n:longint;
begin
readln(n);
a[1]:=1;
a[2]:=2;
a[3]:=4;
a[4]:=6;
if n=1 then begin writeln(1);exit;end;
if n=2 then begin writeln(2);exit;end;
if n=3 then begin writeln(4);exit;end;
if n=4 then begin writeln(6);exit;end;
for i:=5 to n do
begin
a[i]:=2*a[i-1]-2*a[i-3]+a[i-4];
end;
writeln(a[n]);
end.

//{$R-,Q-,S-,I-}
Uses math;
Const
        fin='';
        fon='';
	//fin='.inp';
	//fon='.out';
        maxC=1000000000;
        maxN=1000+10;
	module=1000000007;

Type
	pnode=^tnode;
        tnode=record
                v,c:longint;
                next:pnode;
		end;
	re=record
		x,y:longint;
		end;

Var
        fi,fo:text;
	n,kq:longint;

Procedure mo;
Begin
        Assign(fi,fin); Reset(fi);
        Assign(fo,fon); Rewrite(fo);
End;

Procedure dong;
Begin
        Close(fi);
        Close(fo);
End;

Procedure nhap;
Var
	i:longint;
Begin
        Readln(fi,n);
End;

Procedure xuly;
Var
        i,j:longint;
Begin
        For i:=0 to (n-1) div 2 do
        For j:=i+1 to n-i do
        inc(kq);
End;

Procedure xuat;
Begin
        Writeln(fo,kq);
End;

BEGIN
        Mo;
        Nhap;
        Xuly;
        Xuat;
        Dong;
END.

var
kol,ans,i,n,q:longint;
begin
readln(N);

ans:=n div 2;
for i:=1 to ans do kol:=kol+i;
kol:=kol*2;
if n mod 2= 1 then kol:=kol+ n div 2 + 1;
writeln(kol);
end.

var n,max:longint;
    i,j:longint;
    c:array[0..500]of longint;
begin
  read(n);
  for i:=1 to n do
    for j:=1 to n-i+1 do
     inc(c[i+j-1],n-i-j+2);
  for i:=1 to n do
  if c[i]>max then max:=c[i];
  writeln(max);
end.

var n,y,i,j,k,kol,x:longint;
    d:array[1..10000] of longint;
begin
readln(n);
d[1]:=1;

d[2]:=2;
x:=1;

for i:=3 to n do
begin
 if i mod 2=1
 then inc(x);
 d[i]:=d[i-1]+x;
end;
writeln(d[n]);
end.

var i,j,n,top,bot,res,v:longint;
    kt,l,r:array[0..10009] of longint;

begin
readln(n);
for i:=0 to n-1 do
    for j:=i+1 to n do
        begin
            inc(top);
            l[top]:=i;
            r[top]:=j;
        end;
repeat
     v:=0;
     inc(res);
     for j:=1 to top do
        if (l[j]>=v) and (kt[j]=0) then
            begin
                v:=r[j];
                kt[j]:=1;
                inc(bot);
            end;
until top=bot;
writeln(res);
end.

var a,b,c:longint;
    x:array[0..10000]of longint;
 begin
  x[0]:=0;
  x[1]:=1;
  x[2]:=2;
  x[3]:=4;
  x[4]:=6;
  readln(a);
  if a<=4 then
   writeln(x[a])
  else
   begin
    if a<=100 then
     begin
      for b:=5 to 100 do
       x[b]:=2*x[b-1]-2*x[b-3]+x[b-4];
      writeln(x[a]);
     end
     else
      writeln('0');
   end;
end.

var c,min:real;
a:array[0..1000000] of real;
i:longint;
k,n,z:int64;
begin
read(n);
if n=1 then z:=1 else
if n=2 then z:=2 else
if z=3 then z:=4 else
 begin
 z:=4;
 k:=2;
  for i:=4 to n do
   begin
    if i mod 2=1 then k:=k+1;
    z:=z+k;
   end;
  end;
write(z);
end.

var a,s,d,f,g,h,k: integer;
begin
  read (a);
  if a=1 then begin
                write (1);
                halt;
              end;
  s:=2;
  k:=2;
  d:=2;
  while s<>a do
  begin
  if f=2 then begin k:=k+1; f:=0; end;
    d:=d+k;
    s:=s+1;
    f:=f+1;
  end;
  write (d);
end.

uses math;
var
 n,i,ans : longint;
 a : array[0..101] of longint;
begin
 readln(n);
 for i:=1 to n do a[i]:=n-i+1;
 ans:=0;
 for i:=1 to n do ans:=ans+min(a[i],i);
 writeln(ans);
end.

Program ILoveYou;
VAR n:int64;
Begin
Readln(n);
if (n mod 2 = 0) then Writeln((n div 2)*((n + 2) div 2)) else Writeln(((n + 1)*(n + 1)) div 4);
Readln;
END.

program qwerty;
var a,b,n,i: longint;
m:array [1..100] of int64;
s: array [1..100] of int64;
begin
  readln(n);
  m[1]:=1;
  m[2]:=2;
  m[3]:=4;
  for i:=4 to 100 do
    m[i]:=m[i-2]+i;
  writeln(m[n]);
end.

var
  n: integer;

begin
  read(n);
  write(floor((n + 1) / 2) * ceil((n + 1) / 2));
end.

var s,d,f:string;i,a:longint;z:array[0..200]of int64;

begin
read(a);
 z[1]:=1;
 z[2]:=2;
 for i:=3 to a do z[i]:=i+z[i-2];
 write(z[a]);
end.

         const eps=0.000000001;  besk=20000000000008;
               modul=1000000007;
   label 1,2,3,4,5,6;
    type
    mas=array [-100..1000000] of int64;   point=record x,y,z,vx,vy,vz:int64;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap; point1=^point;
    mass=array[-100..1000000] of int64;mass1=^mass;
    var j1,left,right,gr,xx,yy,sum,ogr,jloz,jnew,i1,i2,i3,maxdob,nn,kk,pos1,pos2,start,ans,pp,qq,aaa,bbb,ccc,tt,aa,bb,jj,ii,ott,time,ppp,istart,jstart,iii,newdl, t1,t2,cc,ll,rr,oldpos,t,jjj,kol,pos,dloch,told,p,q,pmin,ppold,ot,pmax,imax,p1,p2,p3,p4,l,nm,n,s2,m,smin,cen:int64;
   mask,k, step, i,j:longint;
   pointnew,pointold,pointklad,ppoint:point;
    vot,distmin,hh,dist,s0,s1,aanew,bbnew:extended;
    mm,mx,my,mz,tr,maxright,fact,aold,y,och,s,d11,prev,next,z,x,newc,d,nap:array[-10..2000008] of int64;
    a,b,c:mass;
    sd:array[-1000..1000000] of char;
    yyy:array[-10..10000] of extended;
    dot,ddd:array[-10..1210000] of int64;
    ddminus, ppole:array[-1..200,-10..150,-1..150] of int64;
   sss,text1,text2:array[-10..2000000] of string;
   zanxy,zanxz,zanyz:array[-1..200,-1..200] of boolean;
     sot,ss,stest,ss3,ss1,ss2:string;
     ch1,ch2:char;
     traf,dd1,dd:array[-1..5000,-1..5000] of int64;
     zan,zana,zanb:array[-10..2000000] of boolean;
     marked:array[-100..15000] of boolean;
    {sss:string;ch:char;
   } pole1,pole :array [-10..150,-10..150] of char;
    st:array[-100..100000] of string;
     v0,v1,t0:extended;
     zv:point;
     newx,newy:array[-1..200000] of int64;

     koef,yot:extended;
      globflag, flag2,flag,flag1:boolean;
    function al(x,y:extended):extended; var t0,t1,p,s0,s1:extended;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

{procedure udal(ii:longint);
begin  next[prev[ii]]:=next[ii]; prev[next[ii]]:=prev[ii];  end;
 }
function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k div 2); degg:=p*p mod modul;   end;

end;

function good(ch:char):boolean;
begin
  if (ord(ch)>20)and(ord(ch)<220) then good:=true else good:=false;

end;

begin
   { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }
       read(nn);
       inc(nn);
       writeln((nn div 2)*(nn-nn div 2));

   1:    close(output);
end.

program zzz;
var
  n,res:longint;
begin
  readln(n);
  res:=n+abs(n-2);
  writeln(res);
end.

var n:longint;
begin
 read(n);
 n:=n div 2+n mod 2;
 write(n*(n+1));
end.

var n:longint;
begin
 read(n);
 n:=n div 2;
 write((n+1)*n);
end.

var n,i,s,sum,t,u:longint;
f:array [0..100000] of longint;
begin
//.assign(input,'xf.in');reset(input);
//assign(output,'xf.out');rewrite(output);
readln(n);
if n=1 then writeln(1)
else
  begin
  for i:=2 to n do sum:=sum+2;
  writeln(sum);
  end;
close(input);close(output);
end.

var n:longint;
begin
//assign(input,'xf.in');reset(input);
//assign(output,'xf.out');rewrite(output);
readln(n);
if n mod 2=0 then writeln(2+(n div 2-1)*4)
else writeln(1+(n div 2)*3);
close(input);close(output);
end.

var n,o,i,p:longint;
begin
//assign(input,'xf.in');reset(input);
//assign(output,'xf.out');rewrite(output);
read(n);
if n mod 2=1 then
  begin
  if(n=1)then write(1)
  else if n=3 then write(4)
  else
    begin
    o:=7;p:=5;
    for i:=1 to n div 2-2 do
      begin
      o:=o+p;
      p:=p+2;
      end;
    writeln(o);
    end;
  end
else
  begin
  if n=2 then write(2)
  else if n=4 then write(6)
  else if n=6 then write(10)
  else
    begin
    o:=10;p:=5;
    for i:=1 to n div 2-3 do
      begin
      o:=o+p;
      p:=p+2;
      end;
    writeln(o);
    end;
  end;
close(input);close(output);
end.

var a,b,c:longint;
    x:array[0..10000]of longint;
 begin
  x[0]:=0;
  x[1]:=1;
  x[2]:=2;
  x[3]:=4;
  x[4]:=6;
  readln(a);
  if a<=4 then
   writeln(x[a])
  else
  begin
   x[a]:=2*x[a-1]-2*x[a-3]+x[a-4];
   writeln(x[a]);
  end;
end.

var n,y,i,j,k,kol,x:longint;
    d:array[1..10000] of longint;
begin
readln(n);
d[2]:=2;
x:=1;

for i:=3 to n do
begin
 if i mod 2=1
 then inc(x);
 d[i]:=d[i-1]+x;
end;
writeln(d[n]);
end.

var n,y,i,j,k,kol,x:longint;
    d:array[1..10000] of longint;
begin
readln(n);
d[2]:=2;
x:=1;
y:=1;
for i:=3 to n do
begin
 x:=x+2;
 inc(kol);
 d[i]:=x+y;
 if kol=2
 then begin
  kol:=0;
  inc(y);
 end;
end;
writeln(d[n]);
end.

var n,k,s:longint;
begin
readln(n);
s:=(n*(n+1)) div 2;
s:=s div 2;
s:=s+1;
writeln(s);
end.

uses math;
var
 n,i,ans : longint;
 a : array[0..101] of longint;
begin
 readln(n);
 for i:=1 to n do a[i]:=n-i+1;
 //if n mod 2=0 then a[n div 2]:=a[n div 2]-(a[n div 2]+1) div 2;
 ans:=0;
 for i:=n downto n div 2+1 do
  begin
   dec(a[n-i],a[i]); inc(ans,a[i]);
   a[i]:=0;
  end;
 for i:=1 to n do ans:=ans+min(a[i],i);
 writeln(ans);
end.

var
 n : longint;
begin
 readln(n);
 if n=1 then begin writeln(1); halt; end;
 n:=n*(n+1) div 2;
 if n mod 2=1 then inc(n);
 writeln(n div 2+1);
end.

var
 n : longint;
begin
 readln(n);
 n:=n*(n+1) div 2;
 if n mod 2=1 then dec(n);
 writeln(n div 2+1);
end.

var
 n : longint;
begin
 readln(n);
 writeln(n*2-2);
end.

var
 n,i,ans : longint;
 a : array[0..101] of longint;
begin
 readln(n);
 for i:=1 to n do a[i]:=n-i+1;
 if n mod 2=0 then a[n div 2]:=a[n div 2]-(a[n div 2]+1) div 2;
 ans:=0;
 for i:=n downto n div 2+1 do
  begin
   dec(a[n-i],a[i]); inc(ans,a[i]);
   a[i]:=0;
  end;
 for i:=1 to n do ans:=ans+a[i];
 writeln(ans);
end.

Program ILoveYou;
VAR n:int64;
Begin
Readln(n);
Writeln(2*(n - 1));
Readln;
END.