#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;

#define MAX 25014

int main(void)
{
	bool p[MAX];
	vector <int> prime;
	int i, j;
	
	for (i = 0; i < MAX; i++){
		p[i] = true;
		if (i % 2 == 0) p[i] = false;
	}
	prime.push_back(2);
	for (i = 3; i < MAX; i += 2){
		if (p[i]){
			prime.push_back(i);
			for (j = 1; i * j < MAX; j++){
				p[i * j] = false;
			}
		}
	}
	
	int n;
	while (scanf("%d", &n), n){
		int res = 0;
		for (i = 0; i < prime.size(); i++){
			for (j = i; j < prime.size(); j++){
				if (prime[i] + prime[j] == n) res++;
				if (n < prime[i] + prime[j]) break;
			}
		}
		printf("%d\n", res);
	}
		
	return 0;
}