#include <iostream> #include <cmath> #include <string> #include <vector> using namespace std; #define maxn 10000 int mark,cnt; int su[maxn]; int find(int su[],int s,int n){ for(int i=0;i<n;i++){ if(su[i]==s) return 1; } return 0; } void getsu(){ cnt=0; for(int i=2;i<maxn;i++){ mark=1; for(int l=2;l<sqrt(i);l++) if(i%l==0) {mark=0;break;} if(mark==1) su[cnt++]=i; } } int main(){ getsu(); freopen("UVa_in.txt","r",stdin); // freopen("UVa_out.txt","w",stdout); // cout<<cnt; // cout<<su[0]<<‘ ‘<<su[1]<<‘ ‘<<su[2]<<‘ ‘<<su[3]<<‘ ‘<<su[4]; int te,ans; while(cin>>te && te!=0){ ans=0; for(int i=0;i<cnt/2;i++){ if(su[i]<(te+1)/2){ if(find(su,te-su[i],cnt)) ans++; } } printf("%d\n",ans); } return 0; }