#include <iostream>
using namespace std;

const int limit = 1000000;
bool prime[limit + 10];

void era() {
    for(int i = 0; i < limit; i++) prime[i] = true;
    prime[0] = prime[1] = false;
    for(int i = 2; i * i <= limit; i++) {
        if(prime[i]) {
            for(int j = 2 * i; j < limit; j += i) {
                prime[j] = false;
            }
        }
    }
}

int main() {
    era();
    int n;

    while(cin >> n) {
        int ans = 0;

        for(int i = 0; i <= n; i++) {
            if(prime[i]) ans++;
        }
        cout << ans << endl;
    }
}
