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

bool check(int in){
	for (int i = 3; i<=sqrt(in); i+=2){
		if (i != 5 && i % 5 == 0)	continue;
		if (in % i == 0)
			return false;
	}
	return true;
}

int PrimeNumber(int in, int start){
	int count = 0;
	if (in > 2)	count++;
	for (int i = start; i <=in; i+=2){
		if (check(i))	count++;
	}

	return count;
}

int main(){
	int in, count500000 = PrimeNumber(500000, 3);

	while (cin >> in, !cin.eof()){
		if (in <= 500000)
			cout << PrimeNumber(in, 3) << endl;
		else
			cout << count500000 + PrimeNumber(in, 500001) << endl;
	}
}