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

#define MAX 25500

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