program best;
var
ss,s,ans:ansistring;
n,i,j,t,lx,ly,l:longint;
data:array[1..1000]of longint;
a,b,c:array[1..100000]of longint;
function mo(x,y:ansistring):ansistring;
var
i,j:longint;
begin
s:='';
lx:=length(x);
ly:=length(y);
for i:=1 to lx+ly do
c[i]:=0;
for i:=lx downto 1 do
a[lx-i+1]:=ord(x[i])-ord('0');
for i:=ly downto 1 do
b[ly-i+1]:=ord(y[i])-ord('0');
for i:=1 to lx do
for j:=1 to ly do
begin
c[i+j-1]:=c[i+j-1]+a[i]*b[j];
c[i+j]:=c[i+j]+c[i+j-1]div 10;
c[i+j-1]:=c[i+j-1]mod 10
end;
if c[lx+ly]>0 then
l:=lx+ly
else
l:=lx+ly-1;
for i:=l downto 1 do
s:=s+chr(ord('0')+c[i]);
exit(s)
end;
begin
assign (input,'best.in');
reset (input);
assign (output,'best.out');
rewrite (output);
readln (n);
if n=4 then
begin
writeln (4);
close (input);
close (output);
halt
end;
for i:=2 to n do
begin
n:=n-i;
inc(t);
data[t]:=i;
if n<=i then
break
end;
if n=i then
begin
inc(data[t]);
dec(n);
end;
for i:=t downto 1 do
begin
if n=0 then
break;
inc(data[i]);
dec(n)
end;
ans:='1';
for i:=1 to t do
begin
str(data[i],ss);
ans:=mo(ss,ans);
end;
writeln (ans);
close (input);
close (output)
end.