#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
bool b[1000000];
int n,i,j,ans;
int GCD(int x,int y)
{
	return y==0?x:GCD(y,x%y);
}
void biao()
{
	for(i=2;i<=999999;i++)
	{
		if(b[i]==0)
		for(j=i+i;j<=999999;j=j+i)
			b[j]=1;
	}
}
int main()
{
	biao();
	while(~scanf("%d",&n))
	{
		ans=0;
		for(i=2;i<=n&&i<5;i++)
		{
			if(b[i]==0)
				ans++;
		}
		for(i=5;i<=n;i=i+6)
		{
			if(b[i]==0)
				ans++;
			if(b[i+2]==0&&i+2<=n)
				ans++;
		}
		printf("%d\n",ans);
	}
}