#include <iostream>
#include <cstdio>

using namespace std;

int sosu[50001];
int sosu_f[50001];

int era(void){
    int k=0;
    sosu_f[0]=sosu_f[1]=1;
    for(int i=2;i<=50000;i++){
        if(!sosu_f[i]){
            sosu[++k]=i;
            for(int j=i;j<=50000;j+=i){
                sosu_f[j]=1;
            }
        }
    }
    return k;
}

int main(void){
    int n,sum,k;
    int count;
    
    k=era();
    
    while(cin>>n,n!=0){
        count=0;
        if(n%2){
            cout<<'0'<<endl;
            continue;
        }
        for(int i=0;i<=k;i++){
            if(n<sosu[i])break;
            for(int j=i;j<=k;j++){
                sum=sosu[i]+sosu[j];
                if(n<sum)break;
                if(n==sum)count++;
            }
        }
        cout<<count<<endl;
    }
    return 0;
}