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

int main(){
	bool x[1000000];
	int cou, num;
	
	while(cin >>num){
		cou = 0;
		for(int i = 2; i <= num; i++){
			x[i] = true;
		}
		for(int i = 2; i <= sqrt(num); i++){
			if(x[i]){
				for(int j = (i * 2); j <= num; j += i){
					x[j] = false;
				}
			}
		}
		
		for(int i = 0; i <= num; i++){
			if(x[i]){
				cou++;
			}
		}
		
		cout <<cou<<endl;
	}
	
	return 0;
}