def index(n:int, a: int):

    if a % 2 == 0:

        i = n // 2 - a // 2

        j = (i + 1) * -1

        return (i, j) if i != n // 2 else (i,)

    else:

        i = (n // 2 - 1) - (a - 1) // 2

        j = (i + 1) * -1

        return (i, j)



n = int(eval(input()))

line = [0 for _ in range(n)]

for a in map(int, input().split()):

    for i in index(n, a):

        line[i] += 1

else:

    if n == 1 and line == [1]:

        print((1))

    elif n % 2 == 0 and set(line) == {2}:

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

    elif n % 2 == 1 and set(line) == {1, 2} and line[n//2] == 1:

        print((2 ** ((n - 1) // 2) % (10 ** 9 + 7)))

    else:

        print((0))
n = int(eval(input()))

a = [int(x) for x in input().split()]

line = [abs(i - (n - i - 1)) for i in range(n)]

if sorted(a) == sorted(line):

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

else:

    print((0))
def index(n: int, a: int):
    if a % 2 == 0:
        i = n // 2 - a // 2
        j = (i + 1) * -1
        return (i, j) if i != n // 2 else (i,)
    else:
        i = (n // 2 - 1) - (a - 1) // 2
        j = (i + 1) * -1
        return (i, j)


n = int(eval(input()))
line = [0 for _ in range(n)]
for a in map(int, input().split()):
    for i in index(n, a):
        line[i] += 1
else:
    if n == 1 and line == [1]:
        print((1))
    elif n % 2 == 0 and set(line) == {2}:
        print((2 ** (n // 2) % (10**9 + 7)))
    elif n % 2 == 1 and set(line) == {1, 2} and line[n // 2] == 1:
        print((2 ** ((n - 1) // 2) % (10**9 + 7)))
    else:
        print((0))

n = int(eval(input()))
a = [int(x) for x in input().split()]
line = [abs(i - (n - i - 1)) for i in range(n)]
if sorted(a) == sorted(line):
    print(((2 ** (n // 2)) % (10**9 + 7)))
else:
    print((0))

-def index(n: int, a: int): -    if a % 2 == 0: -        i = n // 2 - a // 2 -        j = (i + 1) * -1 -        return (i, j) if i != n // 2 else (i,) -    else: -        i = (n // 2 - 1) - (a - 1) // 2 -        j = (i + 1) * -1 -        return (i, j) - - -line = [0 for _ in range(n)] -for a in map(int, input().split()): -    for i in index(n, a): -        line[i] += 1 +a = [int(x) for x in input().split()] +line = [abs(i - (n - i - 1)) for i in range(n)] +if sorted(a) == sorted(line): +    print(((2 ** (n // 2)) % (10**9 + 7))) -    if n == 1 and line == [1]: -        print((1)) -    elif n % 2 == 0 and set(line) == {2}: -        print((2 ** (n // 2) % (10**9 + 7))) -    elif n % 2 == 1 and set(line) == {1, 2} and line[n // 2] == 1: -        print((2 ** ((n - 1) // 2) % (10**9 + 7))) -    else: -        print((0)) +    print((0))