#include <iostream>

using namespace std;

bool P[1000000];

int main() {
    int n, ans;
    while (cin >> n) {
        fill(P, P + n + 1, true);
        P[0] = P[1] = false;
        for (int i = 0; i * i <= n; i++) {
            if (P[i]) {
                for (int j = i + i; j <= n; j += i) {
                    P[j] = false;
                }
            }
        }
        ans = 0;
        for (int i = 0; i <= n; i++) if (P[i]) ans++;
        cout << ans << endl;
    }
}
