#include <bits/stdc++.h>
using namespace std;

int main(void){
	int array[30]={ },n;
	for(int* ite=array;cin>>*ite;ite++);
	int max=*(max_element(array,array+30));
	bool* hurui = new bool[max+1];
	fill(hurui,hurui+max+1,true);
	hurui[0]=hurui[1]=false;
	for(int i=2;i<max;i++){
		if(!hurui[i]) continue;
		for(int j=i*2;j<max;j+=i)
			hurui[j]=false;
	}
	for(int* ite=array;*ite;ite++)
		cout << count(hurui+1,hurui+1+(*ite),true) <<endl;
	delete[] hurui;
}