#include <cstdio>
#include <cstring>
const int N=10000010;
typedef long long LL;
LL n;
long long F[N];
LL find(int n)
{
if (n<N) return F[n];else
return find(n/2)+find(n/3)+find(n/5)+find(n/7);
}
int main()
{
freopen("losttemple.in","r",stdin);
freopen("losttemple.out","w",stdout);
scanf("%lld",&n);
F[0]=1;F[1]=1;
for (int i=2;i<N;++i)
F[i]=F[i/2]+F[i/3]+F[i/5]+F[i/7];
if (n<N) printf("%lld\n",F[n]);else printf("%lld\n",find(n));
return 0;
}