#include<stdio.h>
#include<math.h>
#define ullint unsigned long long int

// ?????°???(a^b %d ????¨????)
int modpow(ullint a, ullint b, long int d) {
  if (b == 0)     return 1;
  if (b % 2 == 0) return modpow(a*a % d, b/2, d);
  else            return a*modpow(a, b-1, d) % d;
}

// Miller???Rabin?´???°?????????
bool Miller_Rabin_Test(int n){
    int prime_list[4] = {2, 7, 61};

    if(n == 2 || n == 7 || n == 61){  // 2,7,61????´???°
        return true;
    }
    if(n == 1 || n%2 == 0){  // 2??\????????¶??°??¨1????´???°??§??????
        return false;
    }
    // n = 2^s*d + 1 (d????\???°)?????¢????????¢
    int d = n-1;
    int s = 0;
    while(d%2 == 0){  // d????\???°??????????????§?????¢
        d = d/2;
        s++;
    }
    for(int i=0; i<3; i++){  // ??????????????????3???
        bool isProbPrime = false;
        int a = prime_list[i];
        int r = modpow(a, d, n);
        if(r == 1 || r == n-1){
            isProbPrime = true;
            continue;
        }
        for(int j=0; j<s; j++){
            r = modpow(a, pow(2,j)*d, n);
            if(r == n-1){
                isProbPrime = true;
                break;
            }
        }
        if(!isProbPrime){
            return false;
        }
    }
    return true;
}

int Primenum[1000000];

int main(){
    Primenum[1] = 0;
    for(int i=1; i<=1000000; i++){
        if(Miller_Rabin_Test(i)){
            Primenum[i] = Primenum[i-1] + 1;
        }else{
            Primenum[i] = Primenum[i-1];
        }
    }
    for(int n; scanf("%d\n",&n) != EOF;){
        printf("%d\n",Primenum[n]);
    }
    return 0;
}