#include <iostream>

using namespace std;

const int iMAX = 1000000;
const int iMAX_half = 500000;
int isPrime[iMAX];

int main()
{
	int n, cnt, sqSize;
	bool prime[iMAX_half];

	cnt = 1;
	sqSize = 1000;
	prime[0] = prime[1] = 0; prime[2] = 1;
	for(int i=3; i < iMAX; i+=2) prime[(i-1)>>1] = 1;
	for(int i=3; i < sqSize; i+=2) {
		if(prime[(i-1)>>1]) {
			for(int j=i+i+i; j < iMAX; j+=(i*2))
				if(j & 1) prime[(j-1)>>1] = 0;
		}
	}
	isPrime[0] = isPrime[1] = 0; isPrime[2] = 1;
	for(int i=3; i < iMAX; i+=2) {
		if(prime[(i-1)>>1]) cnt++;
		isPrime[(i-1)>>1] = cnt;
	}
	while(cin >> n)
	{
		if(n == 2)
			cout << 1 << endl;
		else
			cout << isPrime[(n-1)>>1] << endl;
	}

	return 0;
}