def sieve(n):

    primes = [True] * n

    primes[0] = primes[1] = False

    for i in range(2, int(n ** 0.5) + 1):

        if primes[i]:

            for j in range(i * i, n, i):

                primes[j] = False

    return [i for i in range(n) if primes[i]]



primes_a = sieve(25000)

primes_b = set(sieve(50000))

while 1:

    n = eval(input())

    if n == 0:

        break

    ret = 0

    for prime in primes_a:

        if prime > n / 2:

            break

        if n - prime in primes_b:

            ret += 1

    print(ret)
def sieve(n):

    primes = [True] * n

    primes[0] = primes[1] = False

    for i in range(2, int(n ** 0.5) + 1):

        if primes[i]:

            for j in range(i * i, n, i):

                primes[j] = False

    return [i for i in range(n) if primes[i]]



primes = sieve(50000)

ret = [0] * 100001

for i in range(len(primes)):

    for j in range(i, len(primes)):

        tmp = primes[i] + primes[j]

        if tmp > 50000:

            break

        ret[tmp] += 1

while 1:

    n = eval(input())

    if n == 0:

        break

    print(ret[n])
def sieve(n):
    primes = [True] * n
    primes[0] = primes[1] = False
    for i in range(2, int(n**0.5) + 1):
        if primes[i]:
            for j in range(i * i, n, i):
                primes[j] = False
    return [i for i in range(n) if primes[i]]


primes_a = sieve(25000)
primes_b = set(sieve(50000))
while 1:
    n = eval(input())
    if n == 0:
        break
    ret = 0
    for prime in primes_a:
        if prime > n / 2:
            break
        if n - prime in primes_b:
            ret += 1
    print(ret)

def sieve(n):
    primes = [True] * n
    primes[0] = primes[1] = False
    for i in range(2, int(n**0.5) + 1):
        if primes[i]:
            for j in range(i * i, n, i):
                primes[j] = False
    return [i for i in range(n) if primes[i]]


primes = sieve(50000)
ret = [0] * 100001
for i in range(len(primes)):
    for j in range(i, len(primes)):
        tmp = primes[i] + primes[j]
        if tmp > 50000:
            break
        ret[tmp] += 1
while 1:
    n = eval(input())
    if n == 0:
        break
    print(ret[n])

-primes_a = sieve(25000) -primes_b = set(sieve(50000)) +primes = sieve(50000) +ret = [0] * 100001 +for i in range(len(primes)): +    for j in range(i, len(primes)): +        tmp = primes[i] + primes[j] +        if tmp > 50000: +            break +        ret[tmp] += 1 -    ret = 0 -    for prime in primes_a: -        if prime > n / 2: -            break -        if n - prime in primes_b: -            ret += 1 -    print(ret) +    print(ret[n])