#include <bits/stdc++.h>
using namespace std;

int cnt;
vector<int> v;

int judge(int n){
  int c = 0;
  for(int i = 1; i <= sqrt(n); i++){
    if(n%i == 0) c++;
  }
  if(c == 1) return 0;
  return 1;
}

void solve(){
  int c = 0;
  for(int i = 2; i <= 25000; i++){
    if(judge(i) == 0){
      // cout << i << endl;
      v.push_back(i);
    }

  }


}

int main(){

  solve();

  int a, b;
  while(cin >> a && a){
    cnt = 0;
    for(int i = 0; i < v.size(), v[i] < a; i++){
      for(int j = i; j < v.size(), v[j] < a; j++){
      // cout << v[i] << " " << v[j] << endl;
      if(v[i] + v[j] == a) cnt++;
      }
    }
    cout << cnt << endl;
  }


}