#include <iostream>
#include <cmath>
using namespace std;

int main(){
    int n, cnt;
    bool prime[1000000];
    prime[0] = prime[1] = false;
    
    for(int i = 2;i <= 1000000;i++){
        prime[i] = true;
    }

    while(cin >> n){
        cnt = 0;
        
        for(int i = 2;i <= sqrt(n);i++){
            if(prime[i]){
                for(int j = 2*i;j<= n;j++){
                    if(j%i == 0){
                        prime[j] = false;
                    }
                }
            }
        }
        
        for(int i = 2;i <= n;i++){
            if(prime[i]){
                cnt++;
            }
        }
        
        cout << cnt << endl;
    }

    return 0;
}