#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

const int PS = 50001;
int prime[PS];
int set_prime(){
	rep(i,PS)prime[i]=1;
	prime[0]=prime[1]=0;
	rep(i,PS){
		if(prime[i]==0)continue;
		for(int j=i*2;j<PS;j+=i)prime[j]=0;
	}
}


int main(){
	set_prime();
	vector<int> s;
	rep(i,PS)if(prime[i]==1)s.push_back(i);
	
	int n;
	while(cin>>n){
		int sum = 0;
		rep(i,s.size()){
			reps(j,i,s.size()){
				if(s[i]+s[j]==n)sum++;
			}
		}
		printf("%d\n",sum);
	}
}