#include <iostream>
#include <bitset>
using namespace std;

class PrimeBox
{
private:
	bitset<1000000> m_box;
	size_t m_size;

public:
	PrimeBox() :
		m_box(),
		m_size(2)
	{
		m_box.set();
		m_box.reset(0);
		m_box.reset(1);
	}

private:
	void expand(size_t size)
	{
		for(size_t i = m_size + 1; i <= size; i++)
		{
			for(size_t j = 2; j < i; j++)
			{
				if(!m_box.test(j))
					continue;

				if(i % j == 0)
				{
					m_box.reset(i);
					break;
				}
			}
		}
		m_size = size;
	}

public:
	bool isPrime(size_t number)
	{
		if(m_size < number)
			expand(number);

		return m_box.test(number);
	}
};

int main()
{
	PrimeBox box;

	size_t n;
	while(cin >> n)
	{
		int found = 0;
		for(size_t i = 2; i <= n; i++)
		{
			if(box.isPrime(i))
				found++;
		}

		cout << found << endl;
	}

	return 0;
}