#include <iostream>
#include <array>
#include <string>

int main() {
	std::array<bool, 1000000> is_prime_table = { false, false, true };
	for( int i=3; i<=is_prime_table.size(); i+=2 )
		is_prime_table[i] = [&i]() -> bool
		{
			for( int j=3; j*j<=i; j+=2 )
			if ( i % j == 0 )
				return false;
			return true;
		}();

	int num = 0;
	while( std::cin >> num ) {
		int result = num > 1 ? 1 : 0;	// 2

		for( int i=3; i<=num; i+=2 )
			if ( is_prime_table[i] )
				++result;
		std::cout << result << std::endl;
	}
}