#include <cmath>
#include <cstdio>
#include <map>

bool fermat_test(int n) {
    if (n < 2) {
        return false;
    } else if (n == 2) {
        return true;
    } else {
        return (static_cast<int>(std::pow(2, n - 1)) % n) == 1;
    }
}

bool prime_test(int n) {
    if (n < 2) {
        return false;
    } else if (n == 2) {
        return true;
    } else {
        for (int i = 3; i < static_cast<int>(std::sqrt(n)); i += 2) {
            if ((n %= i) == 0) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    std::map<int, int> m;
    int n;
    while (~scanf("%d", &n)) {
        for (int i = 2; i <= n; ++i) {
            if (m.count(i) > 0)
                continue;

            m[i] = m[i - 1] + (fermat_test(i) && prime_test(i));
        }
        printf("%d\n", m[n]);
    }
}