program losttemple;
const
filename='losttemple';
maxn=10000123;
type
point=^node;
node=record
y,f:qword;
next:point;
end;
var
list:array[0..maxn] of point;
n,m:qword;
function search(x:qword):qword;
var
p:point;
y:qword;
begin
p:=list[x mod maxn];
if p=nil then exit(0);
while p<>nil do
begin
y:=p^.y;
if y=x then exit(p^.f);
p:=p^.next;
end;
exit(0);
end;
procedure insert(x,value:qword);
var
p:point;
k:qword;
begin
k:=x mod maxn;
if list[k]=nil then
begin
new(p);
p^.y:=x;
p^.f:=value;
p^.next:=nil;
list[k]:=p;
end else
begin
new(p);
p^.y:=x;
p^.f:=value;
p^.next:=list[k];
list[k]:=p;
end;
end;
function solve(x:qword):qword;
var
value,k:qword;
begin
value:=0;
k:=search(x div 2);
if k=0 then value:=value+solve(x div 2)
else inc(value,k);
k:=search(x div 3);
if k=0 then value:=value+solve(x div 3)
else inc(value,k);
k:=search(x div 5);
if k=0 then value:=value+solve(x div 5)
else inc(value,k);
k:=search(x div 7);
if k=0 then value:=value+solve(x div 7)
else inc(value,k);
insert(x,value);
exit(value);
end;
procedure main;
begin
readln(n);
insert(1,1);
insert(0,1);
if n<2 then writeln(1)
else writeln(solve(n));
end;
begin
assign(input,filename+'.in'); reset(input);
assign(output,filename+'.out'); rewrite(output);
main;
close(input); close(output);
end.