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