#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 1000000
int p[MAX];
void f(){
	int n=0;
	for(int i=2;i<MAX;i++){
		if(p[i]==0){
			p[i] = ++n;
			for(int j=2;j*i<MAX;j++)
				p[j*i] = -1;
		}
		else p[i] = n;
	}
} 
int main(){
	int n;
	f();
	while(cin>>n){	
		cout<<p[n]<<endl;
	}
	return 0;
}