#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 32768;
int str[maxn];
int main()
{
memset(str, 1, sizeof(str));
for(int i = 2; i*i < maxn; i++)
{
if(str[i])
for(int j = i; i*j < maxn; j++)
str[i*j] = 0;
}
int n;
while(cin >> n&&n)
{
int k = 0;
int temp = n/2;
for(int i = 2; i <= temp; i++)
{
if(str[i]&&str[n-i])
{
k++;
}
}
cout << k << endl;
}
}
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 32768;
int str[maxn];
int main()
{
memset(str, 1, sizeof(str));
for(int i = 2; i*i < maxn; i++)
{
if(str[i])
for(int j = i; i*j < maxn; j++)
str[i*j] = 0;
}
int n;
while(cin >> n&&n)
{
int k = 0;
int temp = n/2;
for(int i = 2; i <= temp; i++)
{
if(str[i]&&str[n-i])
{
k++;
}
}
cout << k << endl;
}
}