from collections import Counter



N = eval(input())

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

hist = Counter(A)



def valid():

  if N % 2 == 0:

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

      if hist[i] != 2:

        return False

    return True

  else:

    if hist[0] != 1:

      return False

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

      if hist[i] != 2:

        return False

    return True



if valid():

  a = N/2

  print(2**a % (10**9+7))

else :

  print(0)
from collections import Counter



N = int(eval(input()))

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

ctr = Counter(src)



def valid():

    if N%2:

        if ctr[0] != 1: return False

        i = 2

        while i <= N:

            if ctr[i] != 2: return False

            i += 2

    else:

        i = 1

        while i <= N:

            if ctr[i] != 2: return False

            i += 2

    return True



MOD = 10**9+7

print((2**(N//2) % MOD if valid() else 0))

from collections import Counter

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


def valid():
    if N % 2 == 0:
        for i in range(1, N, 2):
            if hist[i] != 2:
                return False
        return True
    else:
        if hist[0] != 1:
            return False
        for i in range(2, N, 2):
            if hist[i] != 2:
                return False
        return True


if valid():
    a = N / 2
    print(2**a % (10**9 + 7))
else:
    print(0)

from collections import Counter

N = int(eval(input()))
src = list(map(int, input().split()))
ctr = Counter(src)


def valid():
    if N % 2:
        if ctr[0] != 1:
            return False
        i = 2
        while i <= N:
            if ctr[i] != 2:
                return False
            i += 2
    else:
        i = 1
        while i <= N:
            if ctr[i] != 2:
                return False
            i += 2
    return True


MOD = 10**9 + 7
print((2 ** (N // 2) % MOD if valid() else 0))

-N = eval(input()) -A = list(map(int, input().split())) -hist = Counter(A) +N = int(eval(input())) +src = list(map(int, input().split())) +ctr = Counter(src) -    if N % 2 == 0: -        for i in range(1, N, 2): -            if hist[i] != 2: +    if N % 2: +        if ctr[0] != 1: +            return False +        i = 2 +        while i <= N: +            if ctr[i] != 2: -        return True +            i += 2 -        if hist[0] != 1: -            return False -        for i in range(2, N, 2): -            if hist[i] != 2: +        i = 1 +        while i <= N: +            if ctr[i] != 2: -        return True +            i += 2 +    return True -if valid(): -    a = N / 2 -    print(2**a % (10**9 + 7)) -else: -    print(0) +MOD = 10**9 + 7 +print((2 ** (N // 2) % MOD if valid() else 0))