#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[1100],n=0,c;
    bool f;
    while (1==1)
    {
        cin>>a[n];
        if (a[n]==0){
            break;
        }
        n++;
    }
    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: wengsihan
	Language: C++
	Result: Accepted
	Time:10 ms
	Memory:2072 kb
****************************************************************/