#include<stdio.h>

int main()
{
  int n;
  int count;
  int i,j,k;
  int s = 0;

  while(1){
    count = 0;

    scanf("%d",&n);
    if(n == 0){
      break;
    }
    else if(n == 1){
      count++;
    }
      
    else{
        k = 2*n;
        n = n+1;

        if(n%2 == 0){
            n = n+1;
        }

        for(i = n;i <= k;i = i+2){
            for(j = 3;j*j <= i;j = j+2){
                if(i%j == 0){
                    s = 1;
                    break;
                }
            }
            if(s == 0){
                count++;
            }
            s = 0;
        }
    }
    printf("%d\n",count);
  }
    return 0;
}