#include <iostream>
#include <vector>
using namespace std;

int main( void )
{
	// prime numbers table
	const int NUM = 60000;
	vector <bool> isPrime( NUM + 1, false );
	isPrime[2] = true;
	for ( int i = 3; i <= NUM; i += 2 )
	{
		isPrime[i] = true;
	}

	for ( int i = 3; i <= NUM; i += 2 )
	{
		for ( int j = i + i; j <= NUM; j += i )
		{
			isPrime[j] = false;
		}
	}

	int n;
	while ( cin >> n )
	{
		int kotae = 0;
		for ( int i = 3; i <= n; i += 2 )
		{
			for ( int j = i; j <= n; j += 2 )
			{
				if ( isPrime[i] && isPrime[j] )
				{
					if ( i + j == n )
						kotae++;
				}
			}
		}
		if ( n == 4 )
			kotae++;

		cout << kotae << endl;
	}

}