#include<iostream>
#include<cmath>
using namespace std;
int main(){
	static int N,count[1000009];
		count[1] = 1;
	for(int x=3;x<=1000000;x=x+2){
		int flag = 0;
		for(int y=3;y<=sqrt(x);y=y+2){
			if((x%y)==0)	flag = 1;
		}
		count[x] = count[x-2];
		count[x-1] = count[x-2];
		if(flag == 0)	count[x]++;
	}
	count[1] = 0;
	while(cin >> N){
		cout << count[N] << endl;
	}
	return 0;
}