#include <iostream>
#include <vector>
using namespace std;
vector<bool> P(1000000, true);
vector<int> Q(1000000, 0);
int main()
{
	P[0] = P[1] = false;
	for (int i = 2; i * i < P.size(); ++i) {
		for (int j = 2 * i; j < P.size(); j += i)
			P[j] = false;
	}

	for (int i = 2; i < P.size(); ++i) {
		Q[i] = Q[i-1];
		if (P[i]) Q[i]++;
	}
	int n;
	while (cin >> n) cout << Q[n] << endl;
	return 0;
}