program losttemple;
type
arry=^s;
s=record
data,f:qword;
next:arry;
end;
var
n:qword;
f:array[0..10000000] of longint;
p:array[0..10000010] of arry;
procedure insert(i,j:qword);
var
x:arry;
k:qword;
begin
k:=i mod 10000003;
if p[k]=nil then
begin
new(p[k]);
p[k]^.data:=i;
p[k]^.f:=j;
p[k]^.next:=nil;
end
else
begin
new(x);
x^.data:=i;
x^.f:=j;
x^.next:=p[k];
p[k]:=x;
end;
end;
function find(i:qword):qword;
var
x,y:arry;
begin
x:=p[i mod 10000003];
if x=nil then exit(0);
while x<>nil do
begin
if x^.data=i then
exit(x^.f);
x:=x^.next;
end;
find:=0;
end;
function ss(i:qword):qword;
var
j,k,l:qword;
begin
j:=0;
k:=find(i div 2);
if k=0 then j:=j+ss(i div 2)
else inc(j,k);
k:=find(i div 3);
if k=0 then j:=j+ss(i div 3)
else inc(j,k);
k:=find(i div 5);
if k=0 then j:=j+ss(i div 5)
else inc(j,k);
k:=find(i div 7);
if k=0 then j:=j+ss(i div 7)
else inc(j,k);
insert(i,j);
ss:=j;
end;
function work1:longint;
var
i,j:longint;
begin
f[0]:=1;
f[1]:=1;
for i:=2 to n do
f[i]:=f[i div 2]+f[i div 3]+f[i div 5]+f[i div 7];
exit(f[n]);
end;
begin
assign(input,'losttemple.in');reset(input);
assign(output,'losttemple.out');rewrite(output);
readln(n);
if n<=10000000 then
begin
if n<2 then writeln(1)
else writeln(work1);
end
else
begin
insert(1,1);
insert(0,1);
if n<2 then writeln(1)
else writeln(ss(n));
end;
close(input);close(output);
end.