#include <iostream>
#include<iomanip>
#include <cmath>
#include <climits>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <tuple>
#include <map>
#include <list>
#include <string>
#include <numeric>
#include <utility>
#include <cfloat>

using namespace std;

bool is_prime[10000001];

int main(){
    int N;
    while(cin >> N){
    for(int i = 2; i <= N; i++){
        is_prime[i] = true;
    }

    for(int i = 2; i <= N; i++){
        if(!is_prime[i]){
            continue;
        }
        for(int j = 2 * i; j <= N; j += i){
            is_prime[j] = false;
        }
    }

    int ans = 0;
    for(int i = 2; i <= N; i++){
        if(is_prime[i]){
            ans++;
        }
    }
    cout << ans << endl;
    }
}
