#include <iostream>
#include <cmath>
#include <algorithm>

template<int N>
class primes
{
public:
    constexpr static auto NN = static_cast<int>(std::sqrt(N));

public:
    constexpr primes()
    {
        for( int i=2; i<N; ++i )
            not_primes[i] = false;

        for( int i=2; i<NN; ++i ) {
            if ( not_primes[i] ) continue;

            for( int j=i*i; j<N; j+=i ) {
                not_primes[j] = true;
            }
        }
    }

    auto count(int i) const
    {
        return std::count(std::begin(not_primes), std::begin(not_primes) + i + 1, false);
    }

private:
    bool not_primes[N] = {true, true};
};

int main()
{
    constexpr auto N = 999999+1;
    constexpr auto ps = primes<N>{};

    int i;
    while( std::cin >> i ) {
        std::cout << ps.count(i) << std::endl;
    }
}