#include<cstdio>
using namespace std;

int Eratosthenes(int N){

  int count=0;
  bool* IsPrime = new bool[N];
  IsPrime[0] = false;
  IsPrime[1] = false;
  for(int i=2; i<=N;i++){
    IsPrime[i] = true;
  }
  for(int i=2; i*i<=N;i++){
    if(IsPrime[i]){
      for(int j=2*i; j<=N; j+=i)
        IsPrime[j] = false;
      }
  }
  for(int i=0; i<=N;i++)
    if(IsPrime[i]) count++;

  delete[] IsPrime;
  return count;
}

int main(void)
{
    int N[30]={};
    int count=0;
    int i=0;
    while(1){
      if(scanf("%d",&N[i])!=1)
        break;
      i++;
    }
    i=0;
    while(N[i]>0){
      count=Eratosthenes(N[i]);
      printf("%d\n",count);
      i++;
    }

    return 0;
}
