#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
int prime[1000001];
main(){
    int N;
    while(cin >> N){
        fill(prime,prime+1000001,0);
        for(int i = 2;i*i <= N;i++){
            if(prime[i])continue;
            for(int j = i*2;j <= N;j+=i){
                prime[j] = 1;
            }
        }
        int cnt = 0;
        for(int i = 2;i <= N;i++)if(!prime[i])cnt++;
        cout << cnt << endl;
    }
}