#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <ctime>
#define pb(x) push_back(x)
#define me(x,y) memset(x,y,sizeof(x))
#define sd(x) scanf("%d",&x)
#define ss(x) scanf("%s",x)
#define sf(x) scanf("%f",&x)
#define slf(x) scanf("%lf",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define pc(x) printf("%c",x)
#define pn() printf("\n")
#define plld(x) printf("%lld\n",x)
#define ps(x) printf("%s\n",x)
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<y?x:y)
#define sum(x,y) (x+y)
#define INF 0x3f3f3f3f

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

const int maxn=999999+5;

bool vis[maxn];
int prime[maxn];
int sum[maxn];

int get_prime() {
    me(vis,true);
    vis[0]=vis[1]=true;
    int cnt=1;
    for(int i=2;i<maxn;i++) {
        if(vis[i]) prime[cnt++]=i;

        for(int j=1;j<cnt && i*prime[j]<maxn;j++) {
            vis[i*prime[j]]=false;
            if(i%prime[j]==0) break;
        }
    }
    return cnt;
}

void solve() {
    int cnt=get_prime();
    me(sum,0);
    prime[0]=0;
    for(int i=1;i<cnt;i++) {
        for(int j=prime[i];j<prime[i+1];j++) sum[j]=i;
    }
}


int main() {
    solve();
    int n;
    while(sd(n)!=EOF) pd(sum[n]);
	return 0;
}

