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