#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=10000001;
int is_prime[maxn],prime[maxn];
int p;
void judge_prime()
{
    p=0;
    for(int i=0;i<maxn;i++)
        is_prime[i]=1;
    is_prime[0]=is_prime[1]=0;
    for(int i=2;i<maxn;i++)
    {
        if(is_prime[i])
        {
            prime[++p]=i;
            for(int j=i*2;j<maxn;j+=i)
                is_prime[j]=0;
        }
    }
}
int search(int n)
{
    int left=1,r=p;
    while((r-left)>1)
    {
        int mid=(left+r)/2;
        if(prime[mid]==n) return mid;
        else if(prime[mid]>n) r=mid;
        else left=mid;
    }
    return left;
}
int main()
{
    int n;
    judge_prime();
    while(scanf("%d",&n)!=EOF)
    {
        if(n<=1)
        {
            int nn=0;
            printf("%d\n",nn);
        }
        else printf("%d\n",search(n));
    }
}