import java.util.Scanner;
public class d709{
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
long x = 3 , count = 0;
while(x != 0 && count != 1000000){
int num , decide = 3;
x = Integer.parseInt(cin.nextLine());
if(x % 2 == 0 && x !=2 && x != 0 || x == 1){
System.out.println("1");
decide = 0 ;
}else {
num = (int) Math.sqrt((double)x);
for(int i = 3 ; i <= num ; i+=2){
if( x % i == 0 ){
System.out.println("1");
decide = 0;
break;
}else
decide = 1;
}
}
if(decide == 1 || x == 2 || x == 3 || x == 5 || x == 7)
System.out.println("0");
count++;
}
}
}
有人可以給我建議嗎|||,謝謝