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