#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAX = 1000001;
bool p[MAX];
int ps[MAX];
//vector<int> ps(MAX);
int l;
int s[MAX];
int n;

int main()
{
    p[0] = p[1] = 1;
    REP(MAX)if(!p[i])for(int j=i*2;j<MAX;j+=i) p[j] = true;
    REP(MAX)if(!p[i]){ ps[l] = i; l++;}
    
    //cout << "made ps "  << l << endl;

    REP(l)
        for(int j = i;j<l;j++)
        {
            if(ps[i]+ps[j] < MAX) s[ps[i] + ps[j] ] ++;
            else break;
        }

    cout << "made sum "<< endl;
    while(cin >> n && n) cout << s[n] << endl;

    return 0;
}