#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,n=1,x=0;
	cin>>a;
	while(n>=a){
		if(n%3==2&&n%5==3&&n%7==2){
			n++;
			x++;
		else{
			n++;
		} 
			
		}
	cout<<x;
	}
}
/**************************************************************
	Problem: 1055
	User: chenjunlin
	Language: C++
	Result: Compile Error
****************************************************************/