#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> sieves_nonprime(int n) {
    /* sieve of Eratosthenes */
    // returns is_prime([0, n))
    if (n <= 2)
        return vector<int>(n, false);

    vector<int> is_prime(n, true); is_prime[0]=is_prime[1]=false;

    for (long long i=2; i*i<n; ++i)
        if (is_prime[i])
            for (long long j=i*i; j<n; j+=i)
                is_prime[j] = false;

    return is_prime;
}

int main() {
    size_t n=1e6;
    vector<int> is_prime=sieves_nonprime(n);
    for (size_t i=1; i<n; ++i)
        is_prime[i] += is_prime[i-1];

    while (true) {
        int n;
        if (scanf("%d", &n) == EOF)
            break;

        printf("%d\n", is_prime[n]);
    }

    return 0;
}