#include<iostream>
using namespace std;
#define N 200000
int main()
{
    int a[N]={0},n,i,j,z;
    for(i=2;i<=N/2;i++){
	if(a[i]==0){
	    for(j=2;j*i<=N;j++){
		a[i*j]=1;	     
    	    }
	}
    }
    while((cin>>n)!=0){
    	z=0;
	for(i=2;i<=n;i++){
    	    if(a[i]==0)z++;
	}
	cout<<z<<endl;
    }
    return 0;	
}