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

class Sieve_of_Eratosthenes {
public:
	vector<bool> PN;
	
	Sieve_of_Eratosthenes(int x){
		init(x);
	}
	
	void huga(int t, int x){
		if(PN[t]) return;
		for(int i = t*t; i <= x; i+=t)
			PN[i] = true;
	}
	
	void init(int x){
		PN.resize(x+5);
		PN[0]=PN[1]=PN[4]=true;
		for(int i = 6; (i-1)*(i-1) <= x; i+=6)
		huga(i-1,x),huga(i+1,x);
		for(int i = 6; i <= x; i+=6)
			PN[i]=PN[i+2]=PN[i+3]=PN[i+4]=true;
	}
};

int main(){
	const int MAX = 1000000;
	int n;
	
	Sieve_of_Eratosthenes S(MAX);
	vector<int> sum(MAX);
	
	for(int i = 1; i < MAX; i++){
		sum[i] += sum[i-1] + !S.PN[i];
	}
	
	while(cin>>n){
		cout<<sum[n]<<endl;
	}
	return 0;
}

