#include <iostream>
#include <cmath>

const int LIMIT = 1000000;

void eratosthenes(int n, bool *primes);

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    bool primes[LIMIT];
    primes[0] = primes[1] = false;
    for (int i = 2; i < LIMIT; ++i)
        primes[i] = true;
    eratosthenes(LIMIT, primes);

    int num_of_primes[LIMIT] = {};
    for (int i = 1; i < LIMIT; ++i) {
        num_of_primes[i] = num_of_primes[i-1];
        if (primes[i])
            ++num_of_primes[i];
    }

    int n;
    while (std::cin >> n) {
        std::cout << num_of_primes[n] << std::endl;
    }
}

void eratosthenes(int n, bool *primes)
{
    double root_n = std::sqrt((double) n);
    for (int i = 2; i <= root_n; ++i)
        if (primes[i])
            for (int j = i*i; j <= n; j += i)
                primes[j] = false;
}


