#include <iostream>
#include <algorithm>

using namespace std;

bool flag[50001];

int main(){
  int n = 0;

  for (int i = 0; i <= 50000; i++){
    if (i <= 1) flag[i] = false;
    else flag[i] = true;
  }
  for (int i = 2; i <= 1001; i++){
    if(flag[i] == true){
      for(int j = i * 2; j <= 50000; j += i){
        flag[j] = false;
      }
    }
  }
  while(cin >> n){
    int ans = 0;
    for(int i = 2; i <= n; i++){
      for (int j = i; j <= n - i; j++){
        if(i + j == n){
          if (flag[i] == true && flag[j] == true){
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }

  return (0);
}