#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	vector<int> n;
	int temp;
	int n_max = 0;
	do {
		cin >> temp;
		if(temp >= n_max) n_max = temp;
		n.push_back(temp);
	} while(temp != 0);

	vector<int> primes;
	vector<bool> is_prime(n.size(), true);

	is_prime[0] = is_prime[1] = false;
	for(unsigned int i=2;i<n.size();i++) {
		if(is_prime[i]) {
			primes.push_back(i);
			for(unsigned int j=2*i;j<n.size();j+=i) {
				is_prime[j] = false;
			}
		}
	}
	/*
	for(auto it_n = n.begin(); *it_n != 0; it_n++) {
		int ans = 0;
		for(auto it = primes.begin(); *it <= *(primes.end()) / 2; it++) {
			if(binary_search(it+1, primes.end(), *it_n - *it)) ans++;
		}
		cout << ans << endl;
	}
	*/

	vector<int> tabl(50001);
	for(auto ia = primes.begin(); ia != primes.end(); ia++) {
		for(auto ib = primes.begin(); ib != primes.end(); ib++) {
			int temp;
			if((temp = *ia + *ib) <= 50000) tabl.push_back(temp);
		}
	}
	for(unsigned int i=2; i < n.size(); i++) {
		int ans = 0;
		for(auto it = tabl.begin(); it != tabl.end(); it++) {
			if(*it == n[i]) {
				ans++;
				break;
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}