import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int n = in.nextInt();
output(n,solve(n/2));
}
}
private static void output(int n, List<Integer> solve)
{
int i = 0;
for(int p:solve){
if(isPrime(n-p))
i++;
}
System.out.println(i);
}
public static boolean isPrime(int n){
if(n==1)
return false;
for(int i=2;i<=n/2;i++){
if(n%i == 0)
return false;
}
return true;
}
public static List<Integer> solve(int n){
int[] A = new int[n+1];
for(int i=2;i<=n;i++){
A[i]=i;
}
int p = (int)(Math.sqrt(n));
for(int i=2;i<=p;i++){
if(A[i] != 0){
int j = i*i;
while(j<=n){
A[j]=0;
j += i;
}
}
}
List<Integer> primes=new
ArrayList<Integer>();
for(int i=2;i<=n;i++){
if(A[i] != 0)
primes.add(A[i]);
}
return primes;
}
}