#include<iostream>
using namespace std;
int main()
{
	int n,i,j;
	int time_sum = 0;
	int a[100000];
	while (cin >> n)
	{
		if (time_sum == 29) break;
		time_sum = time_sum + 1;
		int sum = 0;
		for (i = 2; i <=n; i++)
			a[i] = 1;
		for (i = 2; i <=n; i++)
		{
			if (a[i])
				for (j = i + i; j <=n; j = j + i)
					a[j] = 0;
		}
		for (i = 2; i <=n; i++)
		{
			if (a[i]) sum = sum + 1;
		}
		cout << sum << endl;
	}
	return 0;

}