#include<bits/stdc++.h>
using namespace std;
int main(){
int n,i=1,c=0;
cin>>n;
while(i<=n)
{
if(i%3==2&&i%5==3&&i%7==2)
{
c++;
}
i++;
}
cout<<c;
return 0;
}
/**************************************************************
Problem: 1055
User: fuhoubin
Language: C++
Result: Accepted
Time:18 ms
Memory:2072 kb
****************************************************************/