#include<iostream>
#include<algorithm>
#include<string>
#include<vector>

#define FOR(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
using namespace std;

void solver() {
    int N;
    while(cin>>N){
        bool* isPrime=new bool[N+1];
        FOR(i,N+1)isPrime[i]=false;
        for (int i = 2; i <= N; ++i)
            isPrime[i] = true;
        for (int i = 2; i <= N; ++i) {
            if (isPrime[i])
                for (int j = 2 * i; j <= N; j += i)
                    isPrime[j] = false;
        }
        int cnt=0;
        FOR(i,N+1)if(isPrime[i])cnt++;
        delete[]isPrime;
        cout<<cnt<<endl;
    }
}

int main() {
    solver();
    return 0;
}