CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
A = list(set(a))
flag = True
if n%2==0:
  if a.count(0)>0:
    flag=False
  else:
    for i in A:
      if a.count(i)!=2:
        flag=False
        break
else:
  if a.count(0)!=1:
    flag=False
  else:
    A.pop(A.index(0))
    for j in A:
      if a.count(j)!=2:
        flag=False
        break
if flag==True:
    print(((2**(n//2))%(10**9+7)))
else:
  print((0))

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
A = list(set(a))
flag = True
if n%2==0:
  if a.count(0)>0 or len(A)!=len(a)//2:
    flag=False
else:
  if a.count(0)!=1 or len(A)!=len(a)//2+1:
    flag=False
if flag==True:
    print(((2**(n//2))%(10**9+7)))
else:
  print((0))
# Original solution
from collections import defaultdict

n = int(eval(input()))
A = [int(i) for i in input().split()]
p = 10 ** 9 + 7

m = n % 2 == 0
cnt = defaultdict(int)

for a in A:
    if (a % 2 == 0) == m:
        print((0))
        exit()
    cnt[a] += 1
    if cnt[a] > 2 or cnt[0] > 1:
        print((0))
        exit()

print((pow(2, (n//2), p)))

# Optimized solution
from collections import defaultdict

n = int(eval(input()))
A = [int(i) for i in input().split()]
p = 10 ** 9 + 7

m = n % 2 == 0
cnt = defaultdict(int)

for a in A:
    if (a % 2 == 0) == m:
        print((0))
        exit()
    cnt[a] += 1

if cnt[0] > 1:
    print((0))
    exit(0)

del cnt[0]

for c in list(cnt.values()):
    if c != 2:
        print((0))
        exit(0)

print((pow(2, (n//2), p)))
# Original solution
n = int(eval(input()))
l = list(map(int,input().split()))
s = 1
if n%2!=0:
  l1 = [i for i in range(0,n,2)]
  for i in l1:
    a = l.count(i)
    if ( (i==0 and a==1) or (i!=0 and a==2)):
      s *= 2
    else:
      s = 0
      break
  else:
    s //= 2
else:
  l1 = [i for i in range(1,n,2)]
  for i in l1:
    a=l.count(i)
    if a==2:
      s *= 2
    else:
      s = 0
      break
print((int(s)%(10**9+7)))
      

# Optimized solution
n = int(eval(input()))
l = list(map(int,input().split()))
s = 1
if n%2!=0:
  if l.count(0)!=1:
    s =0
  else:
    l.remove(0)
    if len(set(l))==(n-1)//2:
      s = 2**((n-1)//2)
    else:
      s =0
else:
    if len(set(l))==n//2:
      s = 2**(n//2)
    else:
      s = 0
print((int(s)%(10**9+7)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

if N % 2 == 0:
    for i in range(1, N, 2):
        if A.count(i) != 2:
            print((0))
            exit()
else:
    if A.count(0) != 1:
        print((0))
        exit()
    for i in range(2, N, 2):
        if A.count(i) != 2:
            print((0))
            exit()

print((2 ** (N // 2) % mod))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

A.sort()
if N % 2 == 0:
    # print(A[0:N:2])
    # print(A[1:N+1:2])
    if A[0:N:2] != A[1:N+1:2]:
        print((0))
        exit(0)
else:
    if A[0] != 0:
        print((0))
        exit()
    if A[1:N-1:2] != A[2:N:2]:
        print((0))
        exit()

print((2 ** (N // 2) % mod))
# Original solution
MOD = 1000000007
n = int(eval(input()))
l = list(map(int,input().split()))
a = {}
for i in l:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1

cur = 1 if n % 2 == 0 else 0

ok = True
while cur < n:
    x = 1 if cur == 0 else 2
    if cur in a and a[cur] != x:
        ok = False
        break
    cur += 2

ans = 0
if ok:
    ans = 1
    for _ in range(n // 2):
        ans = ans * 2 % MOD

print(ans)

# Optimized solution
MOD = 1000000007
n = int(eval(input()))
l = list(map(int,input().split()))
a = {}
for i in l:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1

cur = 1 if n % 2 == 0 else 0

ok = True
while cur < n:
    x = 1 if cur == 0 else 2
    if not cur in a or a[cur] != x:
        ok = False
        break
    cur += 2

ans = 0
if ok:
    ans = 1
    for _ in range(n // 2):
        ans = ans * 2 % MOD

print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split(' ')))

false_flag = 0
if N % 2 == 0:
    count_ = 1
else:
    if A.count(0) != 1:
        false_flag = 1
    count_ = 2
while count_ < N and false_flag == 0:
    if A.count(count_) != 2:
        false_flag = 1
    count_ += 2

if false_flag == 0:
    print((2 ** (N // 2)))
else:
    print((0))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split(' ')))

false_flag = 0
'''
if N % 2 == 0:
    count_ = 1
else:
    if A.count(0) != 1:
        false_flag = 1
    count_ = 2
while count_ < N and false_flag == 0:
    if A.count(count_) != 2:
        false_flag = 1
    count_ += 2
'''

count_list = [0 for i in range(N)]
for index in A:
    count_list[index] += 1

if N % 2 == 0:
    count_ = 1
    diff = -1
else:
    if count_list[0] != 1:
        false_flag = 1
    count_ = 2
    diff = -1
while count_ < N and false_flag == 0:
    #print(count_)
    if count_list[count_] != 2 or count_list[count_ + diff] != 0:
        false_flag = 1
    count_ += 2

if false_flag == 0:
    print(((2 ** (N // 2) ) % 1000000007))
else:
    print((0))
# Original solution
import sys
n=int(eval(input()))
array=[int(i) for i in input().split()]

if n%2==0:
    sub=1
else:
    sub=2
    if array.count(0) != 1:
        print((0))
        sys.exit()

for i in range(sub,n,2):
    if array.count(i) != 2:
        print((0))
        sys.exit()


print((2**int(n/2)))

# Optimized solution
import sys
n=int(eval(input()))
array=list(map(int, input().split()))

if not (0<=min(array) and max(array)<n):
    print((0))
    sys.exit()

if n%2==0:
    if (n**2)/2 != sum(array):
        print((0))
        sys.exit()
else:
    if (n**2-1)/2 != sum(array):
        print((0))
        sys.exit()

sub_list=list(set(array))

if n%2==0:
    if int(n/2)==len(sub_list):
        print(((2 ** int(n / 2))%(10**9 + 7)))
    else:
        print((0))
else:
    if int(n/2)==len(sub_list)-1:
        print(((2 ** int(n / 2)) % (10 ** 9 + 7)))
    else:
        print((0))
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
s = 0
if n % 2 == 0:
    b = [int(i) for i in range(n) if i % 2 == 1]
    for i in b:
        c = a.count(i)
        if c != 2:
            s = 1
            break
    ans = 2 ** len(b) % (10**9 + 7)
else:
    b = [int(i) for i in range(n) if i % 2 == 0]
    for i in b:
        c = a.count(i)
        
        
        if c == 1 and i == 0:
            ans = 1
        elif c != 2:
            s = 1
            break
    ans = 2 ** (len(b)-1) % (10**9 + 7)

if s == 0:
    print(ans)
elif s == 1:
    print('0')

# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
s = 0
b = 0
d = [0]*n
if n % 2 == 0:
    for i in a:
        d[i] += 1 
    for i in range(1,n,2):
        if d[i] != 2:
            s = 1
            break
        else:
            b += 1
    ans = 2 ** b % (10**9 + 7)
else:
    for i in a:
        d[i] += 1 
    
    for i in range(0,n,2):
        if i == 0 and d[0] == 1:
            ans = 1
        elif d[i] != 2:
            s = 1
            break
        else:
            b += 1
    ans = 2 ** (b) % (10**9 + 7)

if s == 0:
    print(ans)
elif s == 1:
    print('0')
# Original solution
N = int(eval(input()))
m = [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)]
for i, a in enumerate(sorted([int(a) for a in input().split()])):
  if m[i] != a:
    ret = 0
    break
else:
  ret = 2 ** (N // 2)

print((ret % (10 ** 9 + 7)))

# Optimized solution
N = int(eval(input()))
if [2 * ((i - 1 + N % 2) // 2) + 1 - N % 2 for i in range(1, N + 1)] == sorted([int(a) for a in input().split()]):
  print(((2 ** (N // 2)) % (10 ** 9 + 7)))
else:
  print((0))
# Original solution
import collections
N = int(eval(input()))
A = list(map(int,input().split()))
ans = 1
count = 0
if N == 1:
    if A[0] == 0:
        ans = 1
    else:
        print((0))

if N % 2 == 0:
    for i in range(1, int(N/2)+1):
        if A.count(i*2-1) == 2:
            count += 1
        else:
            ans = 0
else:
    if A.count(0) == 1:
        for i in range(1, int(N/2)+1):
            if A.count(i*2) == 2:
                count += 1

            else:
                ans = 0
    else:
        ans = 0
for i in range(count):
    ans *= 2
    ans %= 1000000007
print(ans)


# Optimized solution
import collections
N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
A = collections.Counter(A)

ans = 1
count = 0
if N == 1:
    if A[0] == 1:
        ans = 1
    else:
        ans = 0

elif N % 2 == 0:
    for i in range(1, int(N/2)+1):
        if A[i*2-1] == 2:
            count += 1
        else:
            ans = 0
else:
    if A[0] == 1:
        for i in range(1, int(N/2)+1):
            if A[i*2] == 2:
                count += 1

            else:
                ans = 0
    else:
        ans = 0
for i in range(count):
    ans *= 2
    ans %= 1000000007
print(ans)
# Original solution
N = int(eval(input()))
A = input().split()
X = [0] * (N // 2)
count = 0

num = 2 ** (len(A) - len(set(A)))



for a in A:
    k = A.count(str(a))
    if k == 2:
        count += 1
    else:
        pass

K = 2 ** (count/2)

if A.count('0') == 2:
    print((0))
elif K == num:
    print((int(K)))
else:
    print((0))

# Optimized solution
N = int(eval(input()))
o, h = N%2, N//2
arr = [0]*h
for a in map(int, input().split()):
    if a > 0:
        arr[a//2 - o] += 1
if all(c == 2 for c in arr):
    print(((1 << h) % (10**9 + 7)))
else:
    print((0))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
count=0
ans=1
if(N%2==0):
  flag=True
  for i in range(N//2):
    try:
      A.remove(2*i+1)
      try:
        A.remove(2*i+1)
        count+=1
        ans=(ans*2)%(10**9+7)
      except:
        flag=False
        break
    except:
      flag=False
      break
else:
  flag=True
  for i in range((N+1)//2):
    if(i==0):
      try:
        A.remove(0)
      except:
        flag=False
        break
    else:
      try:
        A.remove(2*i)
        try:
          A.remove(2*i)
          count+=1
          ans=(ans*2)%(10**9+7)
        except:
          flag=False
          break
      except:
        flag=False
        break
if(flag==True):
  print(ans)
else:
  print((0))

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
count=0
ans=1
A.sort()
if(N%2==0):
  flag=True
  for i in range(N):
    if(i%2==0):
      if(A[i]!=i+1):
        flag=False
        break
    else:
      if(A[i]!=i):
        flag=False
        break
      else:
        ans=(ans*2)%(10**9+7)
else:
  flag=True
  if(A[0]!=0):
    flag=False
  for i in range(N):
    if(i%2==1):
      if(A[i]!=i+1):
        flag=False
        break
    else:
      if(A[i]!=i):
        flag=False
        break
      else:
        if(i>0):
          ans=(ans*2)%(10**9+7)
if(flag==True):
  print(ans)
else:
  print((0))
# Original solution
import sys
imput=sys.stdin.readline
import collections
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
ans=1
if n%2==1 and collections.Counter(a)[0]==1:
    for i in range(2,n,2):
        if collections.Counter(a)[i]!=2:
            print((0))
            break
        else:
            ans=(ans%(10**9+7))*2%(10**9+7)
    else:
        print((ans%(10**9+7)))
elif n%2==0:
    for i in range(1,n,2):
        if collections.Counter(a)[i]!=2:
            print((0))
            break
        else:
            ans=(ans%(10**9+7))*2%(10**9+7)
    else:
        print((ans%(10**9+7)))
else:
    print((0))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
if n%2==1:
    b=[i for i in range(2,n,2)]
    b=b*2
    b.sort()
    #print(a,b)
    b=[0]+b
    if a==b:
        print((2**(n//2)%(10**9+7)))
    else:
        print((0))
elif n%2==0:
    b=[i for i in range(1,n,2)]
    b=b*2
    b.sort()
    if a==b:
        print((2**(n//2)%(10**9+7)))
    else:
        print((0))
# Original solution
import sys

#計算量O(n/2)
N = int(eval(input()))
A = list(map(int,input().split()))
amari = 10**9 + 7
A.sort()

if N % 2 == 0:
    for i in range(1,N,2):
        if A.count(i) != 2:
            print("0")
            sys.exit()
else:
    if A.count(0) != 1:
        print("0")
        sys.exit()
    for i in range(2,N,2):
        if A.count(i) != 2:
            print("0")
            sys.exit()

print((2**(N//2) % amari))

# Optimized solution
N = int(eval(input()))
A = sorted(list(map(int,input().split())))
amari = 10**9 + 7
ans = []
han = 0

if N % 2 == 0:
    han = 1
else:
    han = 0
    A.insert(0,0)


ans = list(int(i) for i in range(han,N,2))
ans += ans
ans.sort()

if ans == A:
    print((2**(N//2) % amari))
else:
    print("0")
# Original solution
n = int(eval(input())) 
a = list(map(int,input().split())) 
sa = sorted(a) 

if n % 2 == 0:
  k = 1
  l = 0
else:
  k = 0
  l = 1 

a=1000000007
flag = True 
for i,s in enumerate(sa):
  if ((i+l)//2)*2+k != s:
    flag = False
if flag:
  print((2**(n//2) % a))
else:
  print((0)) 


# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))

if n%2==0:
    if sorted(a) != [(k//2)*2+1 for k in range(n)]:
        print((0))
    else:
        ans = 2**(n//2)
        print((ans % (10**9+7)))
else:
    if sorted(a)!= [0]+[(k//2+1)*2 for k in range(n-1)]:
        print((0))
    else:
        ans = 2**(n//2)
        print((ans % (10**9+7)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if N % 2 == 0:
    
    for i in list(range(1, N, 2)):
        if A.count(i) != 2:
            ans = 0
            break
            
else:
    if A.count(0) == 1:
        for i in list(range(2, N, 2)):
            if A.count(i) != 2:
                ans = 0
                break
    else:
        ans = 0

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

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 1
if N % 2 == 0:
    if len(A) != 2*len(set(A)):
        ans = 0
else:
    if A.count(0) == 1:
        A.remove(0)
        if len(A) != 2*len(set(A)):
            ans = 0
    else:
        ans = 0
if ans == 0:
    print((0))
else:
    print(((2**(N//2))%(10**9+7)))
# Original solution
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return eval(input())
def i(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split()))
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
A = l()
ans = 1
for i in range(N):
    c = A.count(i)
    if N%2 == i%2:
        if c:
            ans *= 0
    else:
        if c == 0:
            ans *= 0
        if c == 1:
            if i != 0:
                ans *= 0
        if c == 2:
            ans *= 2
print(ans)

# Optimized solution
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return eval(input())
def i(): return int(eval(input()))
def S(): return input().split()
def I(): return list(map(int,input().split()))
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
A = l()
ans = 1
l = [0]*N
for i in range(N):
    l[A[i]] += 1
for i in range(N):
    c = l[i]
    if N%2 == i%2:
        if c:
            ans *= 0
    else:
        if c == 0:
            ans *= 0
        if c == 1:
            if i != 0:
                ans *= 0
        if c == 2:
            ans *= 2
print((ans%mod))
# Original solution
n = int(eval(input())) 
a = list(map(int,input().split())) 
if n%2==0:
    k = 0
else:
    k = 1
if k==0:
    for i in range(1,n,2):
        if a.count(i)!=2:
            print((0))
    else:
        print(((2**(n//2))%(10**9+7)))
else:
    if a.count(0)!=1:
        print((0))
    else:
        for i in range(2,n,2):
            if a.count(i)!=2:
                print((0))
        else:
            print(((2**(n//2))%(10**9+7)))

# Optimized solution
n = int(eval(input())) 
a = list(map(int,input().split())) 
a = sorted(a)
mod = 10**9+7
if n%2==0:
    k = 0
else:
    k = 1
if k==0:
    for i in range(1,n,2):
        if a[i]!=i or a[i-1]!=i:
            print((0))
            exit()
    else:
        print((2**(n//2)%mod))
else:
    if a[0]!=0:
        print((0))
        exit()
    else:
        for i in range(2,n,2):
            if a[i-1]!=i or a[i]!=i:
                print((0))
                exit()
        else:
            print((2**(n//2)%mod))
# Original solution
def inpl(): return input().split()

n = int(eval(input()))
a = sorted(list(map(int, inpl())))

p = 10 ** 9 + 7

ans = 1
i = (n - 1) % 2
j = 0
while (i + j) < n:
    cnt = a.count(i + j)
    if (j % 2 == 0):
        if cnt != 2:
            if not((cnt == 1) and (((i + j) == 0) or ((i + j) == (n - 1)))):
                ans = 0
                break
        else:
            if ((i + j) == 0):
                ans = 0
                break
            else:
                ans *= cnt
                if ans > p:
                    ans %= p
    else:
        if cnt != 0:
            ans = 0
            break
    j += 1
print(ans)

# Optimized solution
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)
# Original solution
N=int(eval(input()))
A=[int(x) for x in input().split()]

if N%2==1:
    if A.count(0)!=1:
        print((0))
        exit()
    elif A.count(0)==1:
        for i in range(1,N//2):
            if A.count(2*i)==2:
                pass
            else:
                print((0))
                exit()
else:
    for i in range(N//2):
        if A.count(2*i+1)==2:
            pass
        else:
            print((0))
            exit()

print((2**(N//2)))    


# Optimized solution
N=int(eval(input()))
A=[int(x) for x in input().split()]
mod=10**9+7
A=sorted(A)

if N%2==0:
    if all(A[i]==A[i+1] and A[0]==1 and A[1]==1 and A[i]-2==A[i-2] for i in range(2,N,2)):
        print(((2**(N//2))%mod))
    else:
        print((0))
else:
    if all(A[0]==0 and A[i]==A[i-1] and A[i]-2==A[i-2] and A[-1]==N-1 for i in range(2,N,2)):
        print(((2**(N//2))%mod))
    else:
        print((0))
# Original solution
i=input
n=int(i())
print(([0,pow(2,n//2,10**9+7)][sorted(i().split(),key=int)==[str((j+n%2)//2*2+1-n%2)for j in range(n)]]))

# Optimized solution
i=input
n=int(i())
print(([0,pow(2,n//2,10**9+7)][sorted(map(int,i().split()))==[(j+n%2)//2*2+1-n%2for j in range(n)]]))
# Original solution
i=input
n=int(i())
print(([0,pow(2,n//2,10**9+7)][sorted(map(int,i().split()))==[(j+n%2)//2*2+1-n%2for j in range(n)]]))

# Optimized solution
i=input
n=int(i())
print(([0,pow(2,n//2,10**9+7)][sorted(map(int,i().split()))==[j+(j+n+1)%2for j in range(n)]]))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
ans = 0
flag = True
if N % 2 == 1:
  # 奇数個の場合、0,2,2,4,4,～みたいに並んでるはず
  if A[0] == 0:
    for i in range(1, N, 2):
      if A[i] != i+1 or A[i+1] != i+1:
        flag = False
        break
    if flag:
      ans = 2**(N//2) % (10**9+7)
else:  
  # 偶数個の場合、1,1,3,3,5,5,～のように並んでるはず
  if A[0] != 0:
    for i in range(0, N, 2):
      if A[i] != i+1 or A[i+1] != i+1:
        flag = False
        break
    if flag:
      ans = 2**(N//2) % (10**9+7)
print(ans)      

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9+7

if N % 2 == 1: # 0を2個にする
  A.append(0)

A.sort()
od = tuple(A[::2])
ev = tuple(A[1::2])
# Ai と Biで、ある値の登場する回数が等しくなかった場合、明らかに答えは 0 
if od == ev:
  comb = (2**(N//2)) % MOD
  print(comb)
else:
  # 左右対称じゃなく報告と矛盾
  print((0))
# Original solution
n=int(eval(input()))
a=[int(i) for i in input().split()]
sa=set(a)
f=True
if n%2==0:
    if sa=={int(i) for i in range(1,n,2)}:
        for i in range(1,n,2):
            if a.count(i)!=2:
                f=False
                break
    else:
        f=False
else:
    if a.count(0)==1:
        for i in range(2,n,2):
            if a.count(i)!=2:
                f=False
                break
    else:
        f=False
print((2**(n//2) if f else 0))


# Optimized solution
n=int(eval(input()))
a=[int(i) for i in input().split()]
a.sort()
f=True
if n%2==0:
    for i in range(n):
        if a[i]!=i//2*2+1:
            f=False
            break
else:
    for i in range(n):
        if a[i]!=(i+1)//2*2:
            f=False
            break
print((2**(n//2)%(10**9+7) if f else 0))
# Original solution
N = int(eval(input()))
evenFlg = False
flg = False
lastIndex = int((N - (N % 2))/2)
if N % 2 == 0: evenFlg = True
ary = [2 for i in range(lastIndex)]
l = list(map(int, input().split()))
# for i in range(lastIndex):
#   ary.append(2)

if not evenFlg: ary.insert(0, 1)

for r in range(N):
    if evenFlg:
        l[r] = (l[r] - 1) / 2
    else:
        l[r] /= 2
    l[r] = int(l[r])
    ary[l[r]] -= 1
for k in range(lastIndex):
    if ary[k] != 0:
        flg = True
        break
ans = 0 if flg else (2**lastIndex) % (10**9 + 7)

print(ans)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = pow(2, N // 2)
# 0*1 2*2 4*2 2^N/2*2
check = [0 for p in range(0, N // 2 + N % 2)]
for o in A:
    check[o // 2] += 1

for q in range(0, N // 2 + N % 2):
    if q == 0 and N % 2 == 1:
        if check[q] != 1:
            ans = 0
            break
    else:
        if check[q] != 2:
            ans = 0
            break
print((ans % (pow(10, 9) + 7)))