const
mm=10000000;
var
f:array[0..mm]of int64;
i,j:longint;
n:int64;
function dp(k:int64):int64;
var
m:int64;
begin
if k<=mm then exit(f[k]);
m:=dp(k div 2)+dp(k div 3)+dp(k div 5)+dp(k div 7);
exit(m);
end;
begin
assign(input,'losttemple.in');reset(input);
assign(output,'losttemple.out');rewrite(output);
read(n);
f[0]:=1;
f[1]:=1;
if n<=mm then begin
for i:=2 to n do
f[i]:=f[i div 2]+F[i div 3]+F[i div 5]+F[i div 7];
writeln(f[n]);
end
else begin
for i:=2 to mm do
f[i]:=f[i div 2]+F[i div 3]+F[i div 5]+F[i div 7];
writeln(dp(n));
end;
close(input);close(output);
end.