#include<iostream>
#include<algorithm>

using namespace std;

#define MAX 1000000

int p[MAX];

void fanc(void){
	int num = 0;
	for(int ix = 2;ix < MAX;++ix){
		if(p[ix] == 0){
			p[ix] = ++num;
			for(int jx = 2;jx*ix<MAX;++jx)
				p[jx*ix] = -1;
		}else
			p[ix] = num;
	}
}

int main()
{
	int n;
	fanc();
	while(cin >> n)
		cout <<p[n]<<endl;

	return 0;
}