#include <iostream>
#include <math.h>
using namespace std;
int main() {
	unsigned long long int i;
	int n, p, cnt,fg;
	while (cin >> n) {
		i = 3;
		cnt = 1;
		fg = 0;	
		
		if ((int)log10(n) == 3) {
			cnt = 168;
			i = 1001;
		}
		else if ((int)log10(n) == 4) {
			cnt = 1229;
			i = 10001;
		}
		else if ((int)log10(n) == 5) {
			cnt = 9592;
			i = 100001;
		}

		if (200000 < n) {
			cnt = 17984;
			i = 200001;
		}
		if (300000 < n) {
			cnt = 25997;
			i = 300001;
		}
		if (400000<n) {
			cnt = 33860;
			i = 400001;
		}
		if (500000 < n) {
			cnt = 41538;
			i = 500001;
		}
		if (600000<n) {
			cnt = 49098;
			i =600001;
		}
		if (700000<n) {
			cnt = 56543;
			i = 700001;
		}
		if (800000<n) {
			cnt = 63951;
			i = 800001;
		}
		if (900000<n) {
			cnt = 71274;
			i = 900001;
		}



		for (; i <= n; i+=2) {
			for (int j = 3; j <= (int)sqrt(i); j += 2) {
				if (i%j == 0) {
					fg = 1;
					break;
				}
			}
			if (fg)
				fg = 0;
			else
				cnt++;
		}
		if (n == 1)
			cnt--;
		cout << cnt << endl;
	}

	return 0;
}
