# -*- coding: utf-8 -*-



N = int(eval(input()))

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



BN = [0] * (N//2+1)



# 偶奇で分けて集計

for i in range(N):

    if N % 2 != 0:

        BN[N//2 - AN[i]//2] += 1

    else:

        BN[N//2 - (AN[i]//2+1)] += 1



# 偶数の場合は真ん中を考慮

ans = 0

for i in range(len(BN)):

    if BN[i] > 2 or N % 2 != 0 and BN[-1] > 1:

        print((0))

        exit()



# 結果出力

print((2 ** (N//2) % (10 ** 9 +7)))
# -*- coding: utf-8 -*-



import sys

from collections import Counter



def input(): return sys.stdin.readline().strip()

def list2d(a, b, c): return [[c] * b for i in range(a)]

def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1): return int(-(-x // y))

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes(): print('Yes')

def No(): print('No')

def YES(): print('YES')

def NO(): print('NO')

sys.setrecursionlimit(10 ** 9)

INF = 10 ** 18

MOD = 10 ** 9 + 7



N = INT()

A = LIST()



C = Counter(A)

ans = 1

if N % 2 == 0:

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

        if C[i] != 2:

            print((0))

            exit()

        ans *= 2

        ans %= MOD

else:

    if C[0] != 1:

        print((0))

        exit()

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

        if C[i] != 2:

            print((0))

            exit()

        ans *= 2

        ans %= MOD

print(ans)

# -*- coding: utf-8 -*-
N = int(eval(input()))
AN = list(map(int, input().split()))
BN = [0] * (N // 2 + 1)
# 偶奇で分けて集計
for i in range(N):
    if N % 2 != 0:
        BN[N // 2 - AN[i] // 2] += 1
    else:
        BN[N // 2 - (AN[i] // 2 + 1)] += 1
# 偶数の場合は真ん中を考慮
ans = 0
for i in range(len(BN)):
    if BN[i] > 2 or N % 2 != 0 and BN[-1] > 1:
        print((0))
        exit()
# 結果出力
print((2 ** (N // 2) % (10**9 + 7)))

# -*- coding: utf-8 -*-
import sys
from collections import Counter


def input():
    return sys.stdin.readline().strip()


def list2d(a, b, c):
    return [[c] * b for i in range(a)]


def list3d(a, b, c, d):
    return [[[d] * c for j in range(b)] for i in range(a)]


def list4d(a, b, c, d, e):
    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]


def ceil(x, y=1):
    return int(-(-x // y))


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST(N=None):
    return list(MAP()) if N is None else [INT() for i in range(N)]


def Yes():
    print("Yes")


def No():
    print("No")


def YES():
    print("YES")


def NO():
    print("NO")


sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
N = INT()
A = LIST()
C = Counter(A)
ans = 1
if N % 2 == 0:
    for i in range(1, N, 2):
        if C[i] != 2:
            print((0))
            exit()
        ans *= 2
        ans %= MOD
else:
    if C[0] != 1:
        print((0))
        exit()
    for i in range(2, N, 2):
        if C[i] != 2:
            print((0))
            exit()
        ans *= 2
        ans %= MOD
print(ans)

-N = int(eval(input())) -AN = list(map(int, input().split())) -BN = [0] * (N // 2 + 1) -# 偶奇で分けて集計 -for i in range(N): -    if N % 2 != 0: -        BN[N // 2 - AN[i] // 2] += 1 -    else: -        BN[N // 2 - (AN[i] // 2 + 1)] += 1 -# 偶数の場合は真ん中を考慮 -ans = 0 -for i in range(len(BN)): -    if BN[i] > 2 or N % 2 != 0 and BN[-1] > 1: +import sys +from collections import Counter + + +def input(): +    return sys.stdin.readline().strip() + + +def list2d(a, b, c): +    return [[c] * b for i in range(a)] + + +def list3d(a, b, c, d): +    return [[[d] * c for j in range(b)] for i in range(a)] + + +def list4d(a, b, c, d, e): +    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] + + +def ceil(x, y=1): +    return int(-(-x // y)) + + +def INT(): +    return int(eval(input())) + + +def MAP(): +    return list(map(int, input().split())) + + +def LIST(N=None): +    return list(MAP()) if N is None else [INT() for i in range(N)] + + +def Yes(): +    print("Yes") + + +def No(): +    print("No") + + +def YES(): +    print("YES") + + +def NO(): +    print("NO") + + +sys.setrecursionlimit(10**9) +INF = 10**18 +MOD = 10**9 + 7 +N = INT() +A = LIST() +C = Counter(A) +ans = 1 +if N % 2 == 0: +    for i in range(1, N, 2): +        if C[i] != 2: +            print((0)) +            exit() +        ans *= 2 +        ans %= MOD +else: +    if C[0] != 1: -# 結果出力 -print((2 ** (N // 2) % (10**9 + 7))) +    for i in range(2, N, 2): +        if C[i] != 2: +            print((0)) +            exit() +        ans *= 2 +        ans %= MOD +print(ans)