#include <stdio.h>

#define MAX 246912

int main(){
  int n, n2, flag[MAX], i, j, count;

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    n2 = 2*n;
    for(i = 0; i < n2 + 1; i++){
      flag[i] = 0;
    }
    count = 0;
    flag[0] -= 1;
    flag[1] -= 1;
 
    for(i = 2; i < n2 + 1; i++){
      if(flag[i] < 0) continue;
      if(n2 < i*i) break;
      for(j = i*i; j < n2 + 1; j += i){
        flag[j] -= 1;
      }

    }

    for(i = 0; i < n2 + 1; i++){
      if( (0 == flag[i])&&(n < i) ){
        count++;
      }
    }

    printf("%d\n", count);
  }

  return 0;
}

