#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int maxn=999999+10;
int n,cnt;
int pre[maxn],prime[maxn];
int bina_search(int l,int r){
	int mid=(l+r)/2;
	if((prime[mid]<n&&prime[mid+1]>n)||prime[mid]==n)
		return mid;
	if(prime[mid]<n)
		bina_search(mid+1,r);
	else
		bina_search(l,mid);
}
int main(){
	memset(pre,0,sizeof(pre));
	memset(prime,0,sizeof(prime));
	int t=1;
	for(int i=2;i<maxn;i++){
		if(!pre[i])
			prime[t++]=i;
		for(int j=1;j<=t&&i*prime[j]<maxn;j++){
			pre[prime[j]*i]=prime[j];
			if(i%prime[j]==0)
					break;
		}
	}
	while(scanf("%d",&n)!=EOF){
		cnt=bina_search(2,n);
		printf("%d\n",cnt);
	}
	return 0;
}