#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
vector<bool> GetPrimeTable(int n)
{
	vector<bool> IsPrimeNumber(n+1, true);
	for(int i = 2; i <= n; i++){
		while(IsPrimeNumber[i] == false){
			i++;
		}
		for(int j = 2; i*j <= n; j++){
			IsPrimeNumber[i*j] = false;
		}
	}
	return IsPrimeNumber;
}

int GetPrimeCount(vector<bool>& PrimeTable, int n)
{
	int Count = 0;
	for(int i = 2; i <= n; i++){
		if(PrimeTable[i] == true){
			Count++;
		}
	}
	return Count;
}

int main()
{
	vector<bool> PrimeTable = GetPrimeTable(999999);
	while(true){
		int Nubmer;
		cin >> Nubmer;
		if(cin.eof() == true) break;
		cout << GetPrimeCount(PrimeTable, Nubmer) << endl;
	}
	return 0;
}