N = int(eval(input()))

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



A.sort()

ans = 1

mod = 10**9+7



if len(A)%2==0:

    for i in range(N//2):

        if A[i*2] == A[i*2+1] == i*2+1:

            ans *= 2

            ans %= mod

        else:

            ans = 0

            break

else:

    for i in range((N-1)//2):

        if A[i*2+1] == A[i*2+2] == (i+1)*2:

            ans *= 2

            ans %= mod

        else:

            ans = 0

            break

    if A[0]!=0:

        ans = 0



print(ans)
# python3 (3.4.3)

import sys

input = sys.stdin.readline



# main

from collections import Counter

N = int(eval(input()))

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

mod = 10**9+7



C = dict(Counter(A))



ans = 1

if N%2==0:

    for i in range(N//2):

        if C.get(i*2+1) == 2:

            ans *= 2

            ans %= mod

        else:

            ans = 0

            break

else:

    if C[0] == 1:

        for i in range(N//2):

            if C.get(i*2+2) == 2:

                ans *= 2

                ans %= mod

            else:

                ans = 0

                break

    else:

        ans = 0



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

# python3 (3.4.3)
import sys

input = sys.stdin.readline
# main
from collections import Counter

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

+# python3 (3.4.3) +import sys + +input = sys.stdin.readline +# main +from collections import Counter + -A.sort() +mod = 10**9 + 7 +C = dict(Counter(A)) -mod = 10**9 + 7 -if len(A) % 2 == 0: +if N % 2 == 0: -        if A[i * 2] == A[i * 2 + 1] == i * 2 + 1: +        if C.get(i * 2 + 1) == 2: -    for i in range((N - 1) // 2): -        if A[i * 2 + 1] == A[i * 2 + 2] == (i + 1) * 2: -            ans *= 2 -            ans %= mod -        else: -            ans = 0 -            break -    if A[0] != 0: +    if C[0] == 1: +        for i in range(N // 2): +            if C.get(i * 2 + 2) == 2: +                ans *= 2 +                ans %= mod +            else: +                ans = 0 +                break +    else: