#include <fstream>
using namespace std;
const int MAXINT=15000000;
int tail=0,head=1,counthead=1,downlevel=0;
unsigned long long n,f[15000001]={1,1};
int main(void)
{
ifstream input("losttemple.in");
ofstream output("losttemple.out");
input>>n;
while (n/2>head+downlevel*MAXINT)
{
head++;
counthead++;
if (head>MAXINT)
{
downlevel++;
head=0;
}
f[head]=f[((head+downlevel*MAXINT)/2)%MAXINT]+f[((head+downlevel*MAXINT)/3)%MAXINT]+f[((head+downlevel*MAXINT)/5)%MAXINT]+f[((head+downlevel*MAXINT)/7)%MAXINT];
if (counthead==7)
{
tail++;
counthead=0;
if (tail>MAXINT)
tail=0;
}
}
if (n>=2)
output<<f[(n/2)%MAXINT]+f[(n/3)%MAXINT]+f[(n/5)%MAXINT]+f[(n/7)%MAXINT]<<endl;
else
output<<"1\n";
input.close();
output.close();
return(0);
}