#include<iostream>
using namespace std;

bool isPrime(unsigned int n);

int main(void){
  int n;
  while(cin>>n && n){
    unsigned int count=0;
    if(n==4) count=1;
    for(unsigned int i=3;i<=n/2;i+=2) if(isPrime(i) && isPrime(n-i)) count++;
    cout<<count<<endl;
  }
}

bool isPrime(unsigned int n){
  for(unsigned int i=3;i*i<=n;i+=2) if(n%i==0) return false;
  return true;
}