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