#include<stdio.h>
#include<math.h>
int solve(int n,int start,int end);
int nextprime(int n);
int prime[500000];
int getprime(void);
int main(void)
{
	int n;
	int all = getprime();
	while (scanf("%d", &n) == 1)
	{
		
		printf("%d\n",solve(n,0,all)+1);
	}
}
int solve(int n,int start,int end)
{

	if (end == start)
	{
		if (n < prime[end])
			return end - 1;
		else return end;
	}
	int k = (end + start) / 2;
	if (n < prime[k])
		return solve(n, start, k-1);
	if (n > prime[k])
		return solve(n, k+1, end);
	return k;
}
int nextprime(int n)
{
	for (int i = n + 1;; i++)
	{
		int pan=1;
		for (int k = 2; k <= sqrt(i); k++)
		{
			if (i%k == 0)
			{
				pan = 0;
				break;
			}
		}
		if (pan)
			return i;
	}
}
int getprime(void)
{
	int i = 1, n = 0;
	while ((i = nextprime(i)) < 999999)
	{
		prime[n] = i;
		n++;
	}
	return n-1;
}