It is known that even numbers greater than or equal to 4 can be represented by the sum of two prime numbers. This is called the Goldbach's conjecture, and computer calculations have confirmed that it is correct up to a fairly large number. For example, 10 can be represented by the sum of two prime numbers, 7 + 3 and 5 + 5.

Write a program that inputs the integer n and outputs how many combinations of n are the sum of two prime numbers. However, n must be 4 or more and 50,000 or less. Also, the n entered is not always even.



Input

Given multiple datasets. Each dataset is given n on one row. When n is 0, it is the last input. The number of datasets does not exceed 10,000.

Output

For each dataset, output the number of combinations in which n is the sum of two prime numbers on one line.

Example

Input

10
11
0


Output

2
0
#4から50000までの素数を見つけ出す
MAX=50001
SQRT=233

num=[True for i in range(MAX)]
def prime(num):
    num[0]=num[1]=False
    for i in range(4,MAX,2):
        num[i]=False
    for i in range(2,SQRT+1):
        if num[i]==True:
            for j in range(i*i,MAX,i):
                num[j]=False

prime(num)

prime_num=[i for i in range(MAX) if num[i]==True]
#print(len(num))
def count(num,n):
    #数える処理
    total=0
    #足していく
    for i in prime_num:
        if i>(n/2):
            break
        if num[n-i]==True:
            #print(i)
            total+=1
    return total
    

while True:
    n=int(input())
    if n==0:
        break
    print(count(num,n))

