def inpl(): return input().split()



n = int(eval(input()))

a = sorted(list(map(int, inpl())))

p = 10 ** 9 + 7



if a[0] == 0:

    st = 1

    next_value = 2

else:

    st = 0

    next_value = 1



ans = 1

found = False

for i in range(st, n):    

    if (next_value == a[i]):

        if found:

            next_value += 2

            found = False

            ans *= 2

            if ans > p:

                ans %= p

        else:

            found = True

    else:

        ans = 0

        break

print(ans)
from collections import Counter



MOD = 10 ** 9 + 7



N = int(eval(input()))

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



ans = 2 ** (N // 2) % MOD

flg = True

b = Counter(a)

if N % 2 == 1:

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

        if i == 0:

            if b[i] != 1:

                flg = False

                break

        else:

            if b[i] != 2:

                flg = False

                break



else:

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

        if b[i] != 2:

            flg = False

            break



print((ans if flg else 0))

def inpl():
    return input().split()


n = int(eval(input()))
a = sorted(list(map(int, inpl())))
p = 10**9 + 7
if a[0] == 0:
    st = 1
    next_value = 2
else:
    st = 0
    next_value = 1
ans = 1
found = False
for i in range(st, n):
    if next_value == a[i]:
        if found:
            next_value += 2
            found = False
            ans *= 2
            if ans > p:
                ans %= p
        else:
            found = True
    else:
        ans = 0
        break
print(ans)

from collections import Counter

MOD = 10**9 + 7
N = int(eval(input()))
a = list(map(int, input().split()))
ans = 2 ** (N // 2) % MOD
flg = True
b = Counter(a)
if N % 2 == 1:
    for i in range(0, N, 2):
        if i == 0:
            if b[i] != 1:
                flg = False
                break
        else:
            if b[i] != 2:
                flg = False
                break
else:
    for i in range(1, N, 2):
        if b[i] != 2:
            flg = False
            break
print((ans if flg else 0))

-def inpl(): -    return input().split() +from collections import Counter - -n = int(eval(input())) -a = sorted(list(map(int, inpl()))) -p = 10**9 + 7 -if a[0] == 0: -    st = 1 -    next_value = 2 +MOD = 10**9 + 7 +N = int(eval(input())) +a = list(map(int, input().split())) +ans = 2 ** (N // 2) % MOD +flg = True +b = Counter(a) +if N % 2 == 1: +    for i in range(0, N, 2): +        if i == 0: +            if b[i] != 1: +                flg = False +                break +        else: +            if b[i] != 2: +                flg = False +                break -    st = 0 -    next_value = 1 -ans = 1 -found = False -for i in range(st, n): -    if next_value == a[i]: -        if found: -            next_value += 2 -            found = False -            ans *= 2 -            if ans > p: -                ans %= p -        else: -            found = True -    else: -        ans = 0 -        break -print(ans) +    for i in range(1, N, 2): +        if b[i] != 2: +            flg = False +            break +print((ans if flg else 0))