#include <stdio.h>
#define N 100

// judge whether n is prime or not
// if prime...return 1,not prime...return 0
int prime_judge(int n){
	if(n == 2) return 1;
	for(int i=2;i<=(n+1)/2;i++){
		if(prime_judge(i)){
			if(n%i == 0) return 0;
		}
	}
	return 1;
}

int count(int n){
	int i,sum=0;
	for(i=2;i<=(n+1)/2;i++){
		if(prime_judge(i) && prime_judge(n-i)) sum++;
	}
	return sum;
}
			
int main(void){
	int origin[N]={0};
	int i,elements;
	for(i=0;i<N;i++){
		scanf("%d",&origin[i]);
		if(origin[i] == 0){
			elements = i;
			break;
		}
	}
	for(i=0;i<elements;i++){
		printf("%d\n", count(origin[i]));
	}

	
}