#include <iostream>
#include <fstream>
using namespace std;
long f[8000001];
long long i,j,k,l;
long long n;
long long m;
long long find(long long x)
{
if (x<=8000000)
return f[x];
m=find(x/2)+find(x/3)+find(x/5)+find(x/7);
return m;
}
int main()
{
ifstream fin("losttemple.in");
ofstream fout("losttemple.out");
f[0]=1;
f[1]=1;
fin>>n;
if (n<8000001)
{
for (i=2;i<=n;i++)
f[i]=f[i/2]+f[i/3]+f[i/5]+f[i/7];
fout<<f[n]<<endl;
}
else
{
for (i=2;i<=8000001;i++)
f[i]=f[i/2]+f[i/3]+f[i/5]+f[i/7];
j=find(n);
fout<<j<<endl;
}
fin.close();
fout.close();
return 0;
}