#include<stdio.h>
int cont=0;
int judge(int);
int main()
{
  int i,n=0,j;
  int NN[100];

  
  while(1){
    scanf("%d",&NN[n]);
    if(NN[n]==0)break;
    n++;
  }
  
  for(i=0;i<n;i++){
    for(j=NN[i]+1;j<=2*NN[i];j++){
      cont+=judge(j);
    }
    printf("%d\n",cont);
    cont=0;
  }
  return 0;
}
   
int judge(int n)
{
  int i;
  if(n<2)return 0;
  else if(n==2)return 1;
  if(n%2==0)return 0;
  for(i=3;i<=n/i;i+=2){
    if(n%i==0)return 0;
  }
  return 1;
}