#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int n, ans; bool not_prime[1000000 + 1];
	for (int i = 2; i <= sqrt(1000000); i++) {
		if (!not_prime[i]) {
			for (int j = i * 2; j <= 1000000; j += i) {
				not_prime[j] = true;
			}
		}
	}
	while (cin >> n) {
		ans = 0;
		for (int i = 2; i <= n; i++) {
			if (!not_prime[i]) { ans++; }
		}
		cout << ans << endl;
	}
	return 0;
}
