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

int* PrimeCount();

int main()
{
	int n;

	int* a = PrimeCount();

	while (cin >> n) {
		cout << a[n] << endl;
	}

	return 0;
}

int* PrimeCount()
{
	//最大探索値 999999まで
	const int MAX = 1000000;

	//配列全てに1
	array<int, MAX> search;

	for (int i = 2; i < MAX; i++) {
		search[i] = 1;
	}

	for (int i = 2; i < MAX; i++)
	{
		//素数
		if (search[i] == 1)
		{
			//素数の倍数に0
			for (int j = i * 2; j < MAX; j += i)
			{
				search[j] = 0;
			}
		}
	}

	//任意の数字以下での素数の数
	for (int i = 1; i < MAX; i++)
	{
		//1が入ってるとカウントも+1
		search[i] += search[i - 1];
	}

	return &search[0];
}
