#include <cstdlib>
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;

vector<int> sieve(int n) {
	vector<int> res{2};
	vector<bool> is_prime(n, true);

	for(int i = 3; i < n; i += 2) {
		if(is_prime[i]) {
			res.emplace_back(i);

			for(int j = i * i; j < n; j += i) {
				is_prime[j] = false;
			}
		}
	}
	return res;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	constexpr int MAX = (1 << 15);
	const auto primes = sieve(MAX);

	unordered_map<int, int> cnt;
	for(unsigned i = 0; i < primes.size(); ++i) {
		for(unsigned j = i; j < primes.size(); ++j) {
			++cnt[primes[i] + primes[j]];
		}
	}

	for(int n; cin >> n && n;) {
		cout << cnt[n] << endl;
	}

	return EXIT_SUCCESS;
}