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

int main(){
	int n;
	while ( cin >> n ){
		bool* table = new bool[ n + 1 ];
		for ( int i = 0; i <= n ; ++i ){
			table[ i ] = false;
		}
		if ( n >= 2 ) table[ 2 ] = true;

		for ( int i = 3; i <= n; i += 2 ){
			table[ i ] = true;
		}
		for ( int i = 3; i <= sqrt( static_cast< double >( n ) ); i += 2 ){
			if ( !table[ i ] ) continue;
			for ( int j = i + i; j <= n; j += i ){
				table[ j ] = false;
			}
		}

		int cnt = 0;
		for ( int i = 0; i <= n; ++i ){
			if ( table[ i ] ) ++cnt;
		}

		cout << cnt << endl;

		delete[] table;
	}
}