n=int(eval(input()))

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

a.sort()

A=(2**(n//2))%(10**9+7)

for i in range(n):

  if i%2==n%2 and i+1!=a[i] or i%2==(n+1)%2 and i!=a[i]:A=0

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

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

a.sort()

A=(2**(n//2))%(10**9+7)

for i in range(n):

  if i+(i-n+1)%2!=a[i]:A=0

print(A)
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
A = (2 ** (n // 2)) % (10**9 + 7)
for i in range(n):
    if i % 2 == n % 2 and i + 1 != a[i] or i % 2 == (n + 1) % 2 and i != a[i]:
        A = 0
print(A)

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

-    if i % 2 == n % 2 and i + 1 != a[i] or i % 2 == (n + 1) % 2 and i != a[i]: +    if i + (i - n + 1) % 2 != a[i]: