from collections import Counter



N = int(eval(input()))

A = list(map(int, input().split()))

MOD = 10**9 + 7



cntA = Counter(A)



if N % 2 == 0:

    for i in range(1, N, 2):

        if cntA[i] != 2:

            print((0))

            exit()

        cntA[i] = 0

    if max(cntA.values()) > 0:

        print((0))

        exit()

    print((pow(2, N // 2, MOD)))

else:

    for i in range(2, N, 2):

        if cntA[i] != 2:

            print((0))

            exit()

        cntA[i] = 0

    if cntA[0] != 1:

        print((0))

        exit()

    cntA[0] = 0

    if max(cntA.values()) > 0:

        print((0))

        exit()

    print((pow(2, N // 2, MOD)))
from collections import Counter



N = int(eval(input()))

A = list(map(int, input().split()))

cntA = Counter(A)



if len(A) % 2 == 1:

    if cntA[0] != 1:

        print((0))

        exit()

    cnt = 1

    for i in range(2, N, 2):

        if cntA[i] != 2:

            print((0))

            exit()

        cnt += 2

    if cnt != N:

        print((0))

        exit()

else:

    cnt = 0

    for i in range(1, N, 2):

        if cntA[i] != 2:

            print((0))

            exit()

        cnt += 2

    if cnt != N:

        print((0))

        exit()



print((pow(2, N // 2, 10**9 + 7)))

from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
cntA = Counter(A)
if N % 2 == 0:
    for i in range(1, N, 2):
        if cntA[i] != 2:
            print((0))
            exit()
        cntA[i] = 0
    if max(cntA.values()) > 0:
        print((0))
        exit()
    print((pow(2, N // 2, MOD)))
else:
    for i in range(2, N, 2):
        if cntA[i] != 2:
            print((0))
            exit()
        cntA[i] = 0
    if cntA[0] != 1:
        print((0))
        exit()
    cntA[0] = 0
    if max(cntA.values()) > 0:
        print((0))
        exit()
    print((pow(2, N // 2, MOD)))

from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
cntA = Counter(A)
if len(A) % 2 == 1:
    if cntA[0] != 1:
        print((0))
        exit()
    cnt = 1
    for i in range(2, N, 2):
        if cntA[i] != 2:
            print((0))
            exit()
        cnt += 2
    if cnt != N:
        print((0))
        exit()
else:
    cnt = 0
    for i in range(1, N, 2):
        if cntA[i] != 2:
            print((0))
            exit()
        cnt += 2
    if cnt != N:
        print((0))
        exit()
print((pow(2, N // 2, 10**9 + 7)))

-MOD = 10**9 + 7 -if N % 2 == 0: +if len(A) % 2 == 1: +    if cntA[0] != 1: +        print((0)) +        exit() +    cnt = 1 +    for i in range(2, N, 2): +        if cntA[i] != 2: +            print((0)) +            exit() +        cnt += 2 +    if cnt != N: +        print((0)) +        exit() +else: +    cnt = 0 -        cntA[i] = 0 -    if max(cntA.values()) > 0: +        cnt += 2 +    if cnt != N: -    print((pow(2, N // 2, MOD))) -else: -    for i in range(2, N, 2): -        if cntA[i] != 2: -            print((0)) -            exit() -        cntA[i] = 0 -    if cntA[0] != 1: -        print((0)) -        exit() -    cntA[0] = 0 -    if max(cntA.values()) > 0: -        print((0)) -        exit() -    print((pow(2, N // 2, MOD))) +print((pow(2, N // 2, 10**9 + 7)))