#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;


int main()
{

	int i,n,count,num;
	deque<int> sosu;
	deque<int>::iterator it;
	bool flg;
	
	//テーブルを予め作成する
	bool prime[1000000] = {false};
	
	prime[2] = true;

	for( i = 3; i <= 1000000 ; i+=2 ) {
		flg = true;	
		for(it = sosu.begin(); it != sosu.end(); it++ ) {
			num = *it;
			if( i < num * num ){
				break;
			}
			if( (i % num ) == 0 ){
				flg = false;
				break;
			}				
		}
		if( flg == true ) {
			sosu.push_back( i );
			prime[i] = true;	
		}
	}
	
	while(cin >> n){
		count = 0;
		if( n == 2 )
			count = 1;
		else if( n < 2 )
			count = 0;
		else {
			for( i = 3; i <= n ; i+=2 ) {
				if( prime[i] == true )
					count++;
			}
			count ++;
		}
		cout << count << endl;
	}
			
	return 0;
}