https://www.acmicpc.net/problem/4948
using System;
class Program
{
static void Main() {
while(true){
string s=Console.ReadLine();
int n=int.Parse(s);
if(n==0) break;
int count=0;
int cnt=0;
for(int i=n+1;i<=2*n;i++){
for(int j=2;j<=(int)Math.Sqrt(i);j++){
if(i%j==0){
cnt=1;
break;
}
}
if(cnt==0) count++;
cnt=0;
}
Console.WriteLine(count);
}
}
}