#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;

int isPrime(int a) {
    for (int i = sqrt(a) + 1; i >= 2; i--)
        if (a % i == 0)
            return 0;

    return 1;
}

int main() {

    #if 0
        ifstream cin("34870.in");
    #endif
            cout << "ok" << endl;
    int many[1000000];

    many[1] = 0;
    many[2] = 1;

    int n;
    while (cin >> n) {
        if (n == 1) {
            cout << 0 << endl;
            continue;
        }


        int i = n;
        while (many[i--] == 0);
        for (i += 1; i <= n; i++) {
            many[i] = many[i-1] + isPrime(i);
        }

        cout << many[n] << endl;
    }

    return 0;
}