#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

void make_sosu(int ans[]){
    int n, i, j, ind, cnt=0;
    ans[0]=2;ans[1]=3;ans[2]=5;ans[3]=7;
    n=9;
    ind=4;
    while(n<=99999){
        cout << "checing::" << n << endl;
        cnt=0;
        for(i=3;i<n;i++){
            if(n%i==0){
                cnt++;
                break;
            }
        }
        if(cnt==0) {
            ans[ind]=n;
            ind++;
        }   
        n+=2;
     }
}

int main(void){
    int n,i,tmp,ans,sosu[100000]={0};
    make_sosu(sosu);
    while(cin>>n){
        if(n==1) cout << "0" << endl;
        else{
            for(i=0;i<n;i++){
                if(n<sosu[i]){
                    cout << i << endl;
                    break;
                }
            }
        }       
    }
    return 0;
}