#include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;





int main()
{
	int n;
	while (cin >> n) {
		int count=0;
		bool prime[1000000];
		fill(prime, prime + n, true);
		prime[0] = false;
		prime[1] = false;
		for (int i = 1; i <= n; i++) {
			if (prime[i]) {
				for (int j = 2 * i; j <= n; j += i) {
					prime[j] = false;
				}
			}
		}
		for (int i = 1; i <= n; i++) {
			if (prime[i]) count++;
		}
		cout << count << endl;
	}





}