from collections import Counter

N = int( eval(input()))

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

Q = 10**9 + 7

ans = 1

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

    if A[i] == 2:

        ans *= 2

        ans %= Q

    else:

        ans = 0

        break

if N%2 == 1:

    if A[0] != 1:

        ans = 0

print(ans)

from collections import Counter

N = int( eval(input()))

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

Q = 10**9 + 7

ans = 1

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

    if A[i] == 1:

        ans = 0

        break

if N%2 == 1:

    if A[0] != 1:

        ans = 0

print((ans*pow(2,N//2,Q)))
from collections import Counter

N = int(eval(input()))
A = Counter(list(map(int, input().split())))
Q = 10**9 + 7
ans = 1
for i in range(N - 1, 0, -2):
    if A[i] == 2:
        ans *= 2
        ans %= Q
    else:
        ans = 0
        break
if N % 2 == 1:
    if A[0] != 1:
        ans = 0
print(ans)

from collections import Counter

N = int(eval(input()))
A = Counter(list(map(int, input().split())))
Q = 10**9 + 7
ans = 1
for i in range(N - 1, 0, -2):
    if A[i] == 1:
        ans = 0
        break
if N % 2 == 1:
    if A[0] != 1:
        ans = 0
print((ans * pow(2, N // 2, Q)))

-    if A[i] == 2: -        ans *= 2 -        ans %= Q -    else: +    if A[i] == 1: -print(ans) +print((ans * pow(2, N // 2, Q)))