#include "stdio.h"
//#include"time.h"
const int MAX_V = 1000000; // 100????????§????´???°??¨?????????
int prime[MAX_V+1]; // 1????´???°,0????´???°??§?????????
int main() {
    int i, k, n;
//    clock_t start, now;//??£?¨?
    for(i = 2; i <= MAX_V; i++){
        prime[i] = 1; // 2??\???????´???°??¨??????
    }
    for(i = 2; i * i <= MAX_V; i++) {
        if(prime[i]) {
            for(k = 2 * i; k <= MAX_V; k += i) {
                prime[k] = 0; // ?´???°???2?????\???????????°????´???°??§?????????
            }
        }
    }
    while (1) {
        int cnt = 0;
        scanf("%d",&n);
//        start = clock(); // ????§???????
        if (n == EOF)break;
        for(i = n;1 <= i;i--){
            if(prime[i] == 1){  //??????????´???°
                cnt++;
            }
        }
//        now = clock(); // ????????????
        printf("%d\n",cnt);//for?????????????????????
//        printf("%f\n", (double)(now - start) / CLOCKS_PER_SEC);
    }
    return 0;
}
//????¨??????¨????????????????????????