#include<iostream>
using namespace std;
long long const MAX_N = 1000000;
bool prim[MAX_N+1];
long long num_prim(long long n){
	long long count = 0;
	for (int i = 2; i <= n; i++)
		prim[i] = true;
	if (n > 2){
		for (int i = 2; i <= n; i++){
			if (prim[i]){
				for (int j = i * 2;j <= n; j += i){
					prim[j] = false;
				}
			}
		}
		for (int i = 2; i <= n; i++)
			if (prim[i])
				count++;
	}
	else{
		count = n - 1;
	}
	
	return count;
}
int main(){
	long long n;
	while (cin >> n){
		cout << num_prim(n)<<endl;
	}
}