program shiluodeshenmiao;
var
t:longint;
n,ans:int64;
team:array[1..10000000]of longint;
data:array[1..10000000]of int64;
function jisuan(k:int64):int64;
var
i,ii:longint;
z,k2,k3,k5,k7,z2,z3,z5,z7:int64;
bz2,bz3,bz5,bz7:boolean;
begin
bz2:=true;
bz3:=true;
bz5:=true;
bz7:=true;
k2:=k div 2;
k3:=k div 3;
k5:=k div 5;
k7:=k div 7;
ii:=1;
for i:=ii to t do
begin
if team[i]=k2 then
begin
z2:=data[i];
bz2:=false
end;
if team[i]=k3 then
begin
z3:=data[i];
bz3:=false
end;
if team[i]=k5 then
begin
z5:=data[i];
bz5:=false
end;
if team[i]=k7 then
begin
z7:=data[i];
bz7:=false
end;
end;
ii:=t+1;
if bz2 then
begin
z2:=jisuan(k2);
inc(t);
team[t]:=k2;
data[t]:=z2
end;
for i:=ii to t do
begin
if team[i]=k3 then
begin
z3:=data[i];
bz3:=false
end;
if team[i]=k5 then
begin
z5:=data[i];
bz5:=false
end;
if team[i]=k7 then
begin
z7:=data[i];
bz7:=false
end;
end;
ii:=t+1;
if bz3 then
begin
z3:=jisuan(k3);
inc(t);
team[t]:=k3;
data[t]:=z3;
end;
for i:=ii to t do
begin
if team[i]=k5 then
begin
z5:=data[i];
bz5:=false
end;
if team[i]=k7 then
begin
z7:=data[i];
bz7:=false
end;
end;
ii:=t+1;
if bz5 then
begin
z5:=jisuan(k5);
inc(t);
team[t]:=k5;
data[t]:=z5
end;
for i:=ii to t do
if team[i]=k7 then
begin
z7:=data[i];
bz7:=false
end;
ii:=t+1;
if bz7 then
begin
z7:=jisuan(k7);
inc(t);
team[t]:=k7;
data[t]:=z7
end;
z:=z2+z3+z5+z7;
exit(z)
end;
begin
assign (input,'losttemple.in');
reset (input);
assign (output,'losttemple.out');
rewrite (output);
readln (n);
t:=2;
team[1]:=0;
data[1]:=1;
team[2]:=1;
data[2]:=1;
ans:=jisuan(n);
writeln (ans);
close (input);
close (output)
end.