#include<stdio.h>
#define M 250000
int main(){
  int i,j,n,c[M]={0};
  char p[M]={1,1};
  for(i=0;i*i<M;i++){
    if(p[i])continue;
    for(j=i*i;j<M;j+=i)p[j]=1;
  }
  for(i=1;i<M;i++)c[i]=c[i-1]+1-p[i];
  while(scanf("%d",&n),n)printf("%d\n",c[n*2]-c[n]);
  return 0;
}