#include<iostream>
#include<sstream>
#include<cstdio>
#include<fstream>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
using namespace std;

#define ull unsigned long long
ull power(ull b,ull e,ull p){
	ull ret = 1;
	while(e>0){
		if((e&1)!=0){
			ret = (ret*b)%p;
		}
		b = (b*b)%p;
		e>>=1;
	}
	return ret%p;
}

bool fermat(ull p){
	if(p!=2 && p%2==0)return false;
	if(p!=3 && p%3==0)return false;
	if(p!=5 && p%5==0)return false;
	if(p!=7 && p%7==0)return false;
	for(int x=0;x<100;++x){
		ull a = rand()%(p-1)+1;
		if(power(a,p-1,p)!=1)return false;
	}	
	return true;
}

int main(){
	int n;
	while(scanf("%d",&n)==1){
		int tot = 0;
		for(int x=2;x<=n;++x){
			if(fermat(x))++tot;
		}
		cout<<tot<<endl;
	}
	return 0;
}