#include <bits/stdc++.h>
using namespace std;
int main()
{
	//c统计素数个数,f判断素数 
	int a[1100],n=0,c;
	bool f;
	while (1==1)
	{
		cin>>a[n];
		if (a[n]==0){
			break;
		}
		n++;
	}
	//i是下标 
	for (int i=0;i<n;i++)
	{
		c=0; 
		
		for(int j=2;j<=a[i];j++) 
		{
			f=true;
			for (int k=2;k<=sqrt(j);k++) 
			{
				if (j%k==0) 
				{
					f=false;
					break;
				}
			}
			if (f==true) c++;
		}
		cout<<c<<endl;
	}
	return 0;
}
/**************************************************************
	Problem: 1176
	User: admin
	Language: C++
	Result: Accepted
	Time:10 ms
	Memory:2072 kb
****************************************************************/