from collections import defaultdict

n = int(eval(input()))

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

d = defaultdict(int)

for x in a:

    d[x] += 1

b = [i for i in range(n)[::-1]]

if not all([d[i] == 2, d[i] == 1][n % 2 and i == 0] for i in b[::2]):

    print((0))

else:

    ans = 1

    for v in list(d.values()):

        ans = ans * v % (10**9+7)

    print(ans)
N = int(eval(input()))

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

flag = True

if N % 2 == 0:

    if 0 in A or len(set(A)) != N//2:

        flag = False

else:

    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N//2+1:

        flag = False

if flag:

    print((2**(N//2) % (10**9+7)))

else:

    print((0))
from collections import defaultdict

n = int(eval(input()))
a = list(map(int, input().split()))
d = defaultdict(int)
for x in a:
    d[x] += 1
b = [i for i in range(n)[::-1]]
if not all([d[i] == 2, d[i] == 1][n % 2 and i == 0] for i in b[::2]):
    print((0))
else:
    ans = 1
    for v in list(d.values()):
        ans = ans * v % (10**9 + 7)
    print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
flag = True
if N % 2 == 0:
    if 0 in A or len(set(A)) != N // 2:
        flag = False
else:
    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N // 2 + 1:
        flag = False
if flag:
    print((2 ** (N // 2) % (10**9 + 7)))
else:
    print((0))

-from collections import defaultdict - -n = int(eval(input())) -a = list(map(int, input().split())) -d = defaultdict(int) -for x in a: -    d[x] += 1 -b = [i for i in range(n)[::-1]] -if not all([d[i] == 2, d[i] == 1][n % 2 and i == 0] for i in b[::2]): +N = int(eval(input())) +A = list(map(int, input().split())) +flag = True +if N % 2 == 0: +    if 0 in A or len(set(A)) != N // 2: +        flag = False +else: +    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N // 2 + 1: +        flag = False +if flag: +    print((2 ** (N // 2) % (10**9 + 7))) +else: -else: -    ans = 1 -    for v in list(d.values()): -        ans = ans * v % (10**9 + 7) -    print(ans)