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

int main(){
	bool arr[1000003];
	int n;
	while(cin >> n){
		int count = 0;
		for(int i = 2; i < 1000003; i++) arr[i] = true;

		for(int i = 2; i < sqrt(n); i++){
			if(arr[i] == true) {
				for(int j = 0; i * (j + 2) <= n; j++) {
				arr[i * (j + 2)] = false;
				}
			}
		}
		for(int i = 2; i <= n; i++){
			if(arr[i] == true) count++;
		}

		cout << count << "\n";
	}
}