CodeEff/ECCO huggingface dataset:
# Original solution
from functools import reduce

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    

    N = int(input().rstrip())
    # A = list(int(_) for _ in input().split())
    A = list(input().split())
    s_num = N -1
    ans = 2**(N//2)
    while s_num > 0:
        count = A.count(str(s_num))
        if(s_num != 0 and count != 2):
            ans = 0 
            break
        elif(s_num == 0 and count !=1):
            ans = 0 
            break
        s_num -= 2
    
    print(ans)
    
if __name__ == '__main__':
    main()


# Optimized solution
from functools import reduce
import bisect

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10

    # mod用
    p=10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    

    N = int(input().rstrip())
    # A = list(map(int, input().split()))
    A = list(int(_) for _ in input().split())
    # A = list(input().split())
    A.sort()
    flag = False
    if A[0] == 0 and N%2 == 1:
        flag = True
        for i in range(N):
            if A[i] != (i + 1) // 2 * 2:
                flag = False
                break
    if A[0] == 1 and N%2 == 0:
        flag = True
        for i in range(N):
            if A[i] != i // 2 * 2 + 1:
                flag = False
                break
    if flag:
        print((2**(N//2) % p))
    else:
        print((0))
        
if __name__ == '__main__':
    main()
# Original solution
from functools import reduce
import bisect

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10

    # mod用
    p=10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    

    N = int(input().rstrip())
    # A = list(map(int, input().split()))
    A = list(int(_) for _ in input().split())
    # A = list(input().split())
    A.sort()
    flag = False
    if A[0] == 0 and N%2 == 1:
        flag = True
        for i in range(N):
            if A[i] != (i + 1) // 2 * 2:
                flag = False
                break
    if A[0] == 1 and N%2 == 0:
        flag = True
        for i in range(N):
            if A[i] != i // 2 * 2 + 1:
                flag = False
                break
    if flag:
        print((2**(N//2) % p))
    else:
        print((0))
        
if __name__ == '__main__':
    main()


# Optimized solution
from functools import reduce
import bisect

def main():
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10

    # mod用
    p=10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    

    N = int(input().rstrip())
    A = list(map(int, input().split()))
    # A = list(int(_) for _ in input().split())
    # A = list(input().split())
    A.sort()
    flag = False
    if A[0] == 0 and N%2 == 1:
        flag = True
        for i in range(N):
            if A[i] != (i + 1) // 2 * 2:
                flag = False
                break
    if A[0] == 1 and N%2 == 0:
        flag = True
        for i in range(N):
            if A[i] != i // 2 * 2 + 1:
                flag = False
                break
    if flag:
        print((2**(N//2) % p))
    else:
        print((0))
        
if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))

if n%2 == 0:
  for i in range(1,n//2+1):
    if a.count(i*2-1) != 2:
      print((0))
      exit()
  print((2**(n//2)))
else:
  if a.count(0) != 1:
    print((0))
    exit()
  for i in range(1,n//2):
    if a.count(i*2) != 2:
      print((0))
      exit()
  print((2**(n//2)))

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

def f(x):
 for i in range(x,N,2):
  if A[i-1]!=i or A[i]!=i:
    return 0
 return 1   
    
a=1
if N%2==0:a=f(1)
else:
 if A[0]!=0:a=0
 else:a=f(2)
print((2**(N//2)%(10**9+7)*a))

# Optimized solution
N=int(eval(input()))
*A,=sorted(map(int,input().split()))

def f(x):
 for i in range(x,N,2):
  if A[i-1]!=i or A[i]!=i:
    return 0
 return 1   
    
a=1
if N%2==0:a=f(1)
else: a=A[0]==0 and f(2)
print((2**(N//2)%(10**9+7)*a))
# Original solution
N = int(eval(input()))
a = list(map(int,input().split()))

aa = dict.fromkeys(a)
f = 0
cnt = 0
for i in aa:
  if i == 0:
    if a.count(0) == 1:
      continue
    else:
      f = 1
  else:
    if a.count(i) == 2:
      cnt += 1
    else:
      f = 1
if f == 0:
  print((pow(2, cnt)))
else:
  print((0))

# Optimized solution
mod = 1000000007

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

data = [0]*N
for i in a:
  data[i] += 1

cnt = 0
for i in range(1,len(data)):
  if data[i] == 2:
    cnt += 1
  elif data[i] == 0:
    continue
  else:
      print((0))
      exit()
print((pow(2, cnt) %mod))
# Original solution
def examC(mod):
    N = I()
    A = LI()
    num = (N+1)%2
    loop = (N+1)//2
    cur = int(1)
    if num==0:
        A.append(0)
        cur = cur/2
    for i in range(loop):
        if A.count(i*2+num)!=2:
            cur = int(0)
            break
        cur = int(cur*2)%mod
    print(cur)




import sys
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC(mod)


# Optimized solution
def examC(mod):
    N = I()
    A = LI()
    num = (N+1)%2
    loop = (N+1)//2
    cur = int(1)
    L = [0]*loop
    if num==0:
        L[0] +=1
    for i in range(N):
        L[A[i]//2] += 1
        if L[A[i]//2]>=3:
            cur = int(0)
            break
    for _ in range(N//2):
        cur = (cur*2)%mod
    print(cur)





import sys
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC(mod)
# Original solution
INFTY = 10**9+7
N = int(eval(input()))
A = list(map(int,input().split()))
if N%2==0:
    flag = 0
    for i in range(1,N,2):
        if A.count(i)==2:
            pass
        else:
            flag = 1
            break
else:
    flag = 0
    for i in range(2,N,2):
        if A.count(i)==2:
            pass
        else:
            flag = 1
            break
    if A.count(0)!=1:
        flag = 1
if flag==0:
    cnt = 1
    for i in range(N//2):
        cnt = (cnt*2)%INFTY
else:
    cnt = 0
print(cnt)

# Optimized solution
INFTY = 10**9+7
N = int(eval(input()))
A = list(map(int,input().split()))
C = {}
for i in range(N):
    if A[i] not in C:
        C[A[i]] = 0
    C[A[i]] += 1
if N%2==0:
    flag = 0
    for i in range(1,N,2):
        if i in C and C[i]==2:
            pass
        else:
            flag = 1
            break
else:
    flag = 0
    for i in range(2,N,2):
        if i in C and C[i]==2:
            pass
        else:
            flag = 1
            break
    if 0 not in C or C[0]!=1:
        flag = 1
cnt = 0
if flag==0:
    cnt = 1
    for i in range(N//2):
        cnt = (cnt*2)%INFTY
print(cnt)
# Original solution
from functools import reduce

if __name__ == "__main__":
    n = int(eval(input()))
    a = [int(x) for x in input().split()]
    x = [0]*n
    if n % 2 == 0:
        for i in a:
            if i % 2 != 1:
                print((0))
                exit()
    else:
        for i in a:
            if i % 2 != 0:
                print((0))
                exit()
    for i in a:
        if i == 0 and x[i] == 1:
            print((0))
            exit()
        elif x[i] == 2:
            print((0))
            exit()
        else:
            x[i] += 1
    print((reduce(lambda x, y: x * y if y != 0 else x, x, 1) % (10 ** 9 + 7)))

# Optimized solution
from functools import reduce

if __name__ == "__main__":
    n = int(eval(input()))
    a = [int(x) for x in input().split()]
    x = [0]*n
    """if n % 2 == 0:
        for i in a:
            if i % 2 != 1:
                print(0)
                exit()
    else:
        for i in a:
            if i % 2 != 0:
                print(0)
                exit()"""
    for i in a:
        if i == 0 and x[i] == 1:
            print((0))
            exit()
        elif x[i] == 2:
            print((0))
            exit()
        else:
            x[i] += 1
    print((reduce(lambda x, y: x * y if y != 0 else x, x, 1) % (10 ** 9 + 7)))
# Original solution


def read_input():
    n = int(eval(input()))
    alist = list(map(int, input().split()))

    return n, alist


def possibility_check(n, alist):
    occurs = {}
    for a in alist:
        if a in list(occurs.keys()):
            occurs[a] += 1
        else:
            occurs[a] = 1

    if n % 2:
        if occurs[0] == 1:
            for i in range(2, n, 2):
                if occurs[i] != 2:
                    return False
            return True
        else:
            return False
    else:
        for i in range(1, n, 2):
            if occurs[i] != 2:
                return False
        return True

def submit():
    n, alist = read_input()

    if possibility_check(n, alist):
        # ans = (2 ** (n // 2)) % (10**9 + 7)
        ans = 1
        for i in range(n // 2):
            ans *= 2
            if ans > 10**9 + 7:
                ans %= (10**9 + 7)
        print(ans)
    else:
        print((0))


if __name__ == '__main__':
    submit()


# Optimized solution


def read_input():
    n = int(eval(input()))
    alist = list(map(int, input().split()))

    return n, alist


def possibility_check(n, alist):
    alist.sort()

    if n % 2:
        even = [x for x in range(2, n) if x % 2 == 0]
        comp = [0] + even + even
        comp.sort()

    else:
        odd = [x for x in range(1, n) if x % 2 == 1]
        comp = odd + odd
        comp.sort()

    if alist == comp:
        return True
    else:
        return False


def submit():
    n, alist = read_input()

    if possibility_check(n, alist):
        # ans = (2 ** (n // 2)) % (10**9 + 7)
        ans = 1
        for i in range(n // 2):
            ans *= 2
            if ans > 10**9 + 7:
                ans %= (10**9 + 7)
        print(ans)
    else:
        print((0))


if __name__ == '__main__':
    submit()
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
if n % 2 == 0:
    for i in range(n//2):
        if not a.count(2*i+1) == 2:
            print((0))
            break
    else: print((2**(n//2) % 1000000007))
else:
    for i in range(1,n//2+1):
        if not a.count(2*i) == 2:
            print((0))
            break
    else:
        if a.count(0) == 1:
            print((2**(n//2) % 1000000007))
        else: print((0))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
if n % 2 == 1:
    if a[0] != 0:
        print((0))
    else:
        for i in range(2, n, 2):
            if not i == a[i-1] == a[i]:
                print((0))
                break
        else: print(((2**(n//2))%1000000007))
else:
    for i in range(1, n, 2):
        if not i == a[i-1] == a[i]:
            print((0))
            break
    else: print(((2**(n//2))%1000000007))
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
import itertools
count = 0
check = tuple([int(abs((N-i+1)- i)) for i in range(1,N+1)])

import math
flag = True
for i in check[0:math.ceil(N/2)]:
    if A.count(i) != 2 and i != 0:
        flag = False
    if A.count(i) != 1 and i == 0:
        flag = False
        
if flag:
    print((2 ** (N//2)))
else:
    print((0))

# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

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

res = 1
if n % 2 == 1:
    if num_map[0] != 1:
        print((0))
    else:
        for i in range(1, (n + 2 - 1) // 2):
            if num_map[i] != 2:
                print((0))
                break
            else:
                res = res * 2 % mod
        else:
            print(res)
else:
    for i in range((n + 2 - 1) // 2):
        if num_map[i] != 2:
            print((0))
            break
        else:
            res = res * 2 % mod
    else:
        print(res)


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
num_map = [0] * ((n + 2 - 1) // 2)
for i in range(n):
    num_map[a[i] // 2] += 1

res = 2 - n % 2
if num_map[0] != 2 - n % 2:
    print((0))
else:
    for i in range(1, (n + 2 - 1) // 2):
        if num_map[i] != 2:
            print((0))
            break
        else:
            res = res * 2 % mod
    else:
        print(res)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
if n%2==0:
  for i in range(0,n,2):
    if a.count(i+1)!=2:
        print((0))
        exit()
else:
  if a.count(0)!=1:
    print((0))
    exit()
  else:
    for i in range(2,n,2):
      if a.count(i)!=2:
        print((0))
        exit()
  
print((2**(n//2)))

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
if n%2==0:
  for i in range(0,n,2):
    if a[i]!=i+1 or a[i+1]!=i+1:
        print((0))
        exit()
else:
  if a[0]!=0:
    print((0))
    exit()
  for i in range(2,n,2):
    if a[i-1]!=i or a[i]!=i:
      print((0))
      exit()
      
print(((2**(n//2))%(10**9+7)))
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
f = True

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

if f:
  print((pow(2,N//2,10**9+7)))
else:
  print((0))

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

if N%2==0:
  B = [2*(i//2)+1 for i in range(N)]
else:
  B = [2*(i//2) for i in range(1,N+1)]

if A==B:
  print((pow(2,N//2,10**9+7)))
else:
  print((0))
# Original solution
N = int(eval(input()))
A = [int(x) for x in input().split()]

flg = True
if N%2 == 0:
  for i in range(1, N, 2): flg &= A.count(i) == 2
else:
  flg &= A.count(0) == 1
  for i in range(2, N+1, 2): flg &= A.count(i) == 2

print((2**(N//2) if flg else 0))


# Optimized solution
N = int(eval(input()))
A = sorted([int(x) for x in input().split()])

flg = True
if N%2 == 0:
  for i in range(0, N//2): flg &= A[2*i] == A[2*i+1] == 2*i+1
else:
  flg &= A[0] == 0
  for i in range(1, (N+1)//2): flg &= A[2*i-1] == A[2*i] == 2*i

def modpow(n, r, m):
  if r == 0: return 1
  if r%2 == 0: return modpow(n, r//2, m)**2 % m
  return n * modpow(n, r-1, m) % m

print((modpow(2, N//2, 10**9+7) if flg else 0))
# Original solution
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))


# Optimized solution
from collections import Counter
N = int(eval(input()))
src = list(map(int,input().split()))
ctr = Counter(src)

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

if is_valid(ctr):
    MOD = 10**9+7
    print((2**(N//2) % MOD))
else:
    print((0))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

if N % 2 == 0:
    for i in range(1, N, 2):
        if A.count(i) != 2:
            print((0))
            exit()
    print((int((2 ** (N/2)) % (10*9 + 7))))
else:
    for j in range(0, N, 2):
        if j == 0:
            if int(A.count(j)) != 1:
                print((0))
                exit()
        else:
            if A.count(j) != 2:
                print((0))
                exit() 
    print((int(2 ** ((N-1)/2) % (10*9 + 7))))


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

#if N % 2 == 0:
#    for i in range(1, N, 2):
#        if A.count(i) != 2:
#            print(0)
#            exit()
#    print(int((2 ** (N/2)) % (10*9 + 7)))
#else:
#    for j in range(0, N, 2):
#        if j == 0:
#            if int(A.count(j)) != 1:
#                print(0)
#                exit()
#        else:
#            if A.count(j) != 2:
#                print(0)
#                exit() 
#    print(int(2 ** ((N-1)/2) % (10*9 + 7)))

# 全探索でやると間に合わなかったので正しい場合の和の値を求めてそれを配列の和と比較する

K = N if N % 2 == 0 else N + 1
S = N // 2
if sum(A) == K * S:
    ans = 2 ** S % (10 ** 9 + 7)
else:
    ans = 0

print(ans)
# Original solution
from sys import exit
N = int(eval(input()))
A = list(map(int, input().split()))
if N % 2 == 0:
    for i in range(N // 2):
        if A.count(i * 2 + 1) != 2:
            print((0))
            exit()
        else:
            continue
    print((int(2 ** (N / 2)) % (10 ** 9 + 7)))
else:
    n = 0
    if A.count(0) != 1:
        print((0))
        exit()
    else:
        for i in range(N // 2):
            if A.count(i * 2 + 2) != 2:
                print((0))
                exit()
            else:
                continue
    print((int(2 ** (N // 2)) % (10 ** 9 + 7)))
  

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

for i in range(N):
    a_comb.append(abs(i - (N - 1 - i)))

if sorted(a_comb) == sorted(a):
    print((2 ** (N // 2) % mod))
else:
    print((0))
# Original solution
import sys
N = int(eval(input()))
alist = list(map(int,input().split()))
flg = True
if N == 1:
    if alist[0] == 0:
        print((1))
    else:
        print((0))
    sys.exit()
inf = 10 ** 9 + 7
if N % 2 == 0:
    for i in range(N)[1::2]:
        if alist.count(i) != 2:
            flg = False
else:
    for i in range(N)[2::2]:
        if alist.count(i) != 2:
            flg = False
if flg:
    print(((2 ** (N // 2)) %  inf))
else:
    print((0))

# Optimized solution
import sys
N = int(eval(input()))
alist = list(map(int,input().split()))
flg = True
if N == 1:
    if alist[0] == 0:
        print((1))
    else:
        print((0))
    sys.exit()
inf = 10 ** 9 + 7
alist.sort()
if N % 2 == 0:
    for i in range(N)[1::2]:
        if alist[i-1] != i or alist[i] != i:
            flg = False
            break
else:
    if alist[0] != 0:
        flg = False
    for i in range(N)[2::2]:
        if alist[i-1] != i or alist[i] != i:
            flg = False
            break
if flg:
    print(((2 ** (N // 2)) %  inf))
else:
    print((0))
# Original solution
from collections import defaultdict
n = int(eval(input()))
a = list(map(int, input().split()))
d = defaultdict(int)
for x in a:
    d[x] += 1
b = [i for i in range(n)[::-1]]
e = all(d[i] == 2 if n % 2 == 0 else d[i] ==
        1 if i == 0 else d[i] == 2 for i in b[::2])
if not e:
    print((0))
    exit()
ans = 1
for v in list(d.values()):
    ans = ans * v % (10**9+7)
print(ans)


# Optimized solution
from collections import defaultdict
n = int(eval(input()))
a = list(map(int, input().split()))
d = defaultdict(int)
for x in a:
    d[x] += 1
b = [i for i in range(n)[::-1]]
if not all([d[i] == 2, d[i] == 1][n % 2 and i == 0] for i in b[::2]):
    print((0))
else:
    ans = 1
    for v in list(d.values()):
        ans = ans * v % (10**9+7)
    print(ans)
# Original solution
from collections import defaultdict
n = int(eval(input()))
a = list(map(int, input().split()))
d = defaultdict(int)
for x in a:
    d[x] += 1
b = [i for i in range(n)[::-1]]
if not all([d[i] == 2, d[i] == 1][n % 2 and i == 0] for i in b[::2]):
    print((0))
else:
    ans = 1
    for v in list(d.values()):
        ans = ans * v % (10**9+7)
    print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
flag = True
if N % 2 == 0:
    if 0 in A or len(set(A)) != N//2:
        flag = False
else:
    if len([0 for a in A if a == 0]) != 1 or len(set(A)) != N//2+1:
        flag = False
if flag:
    print((2**(N//2) % (10**9+7)))
else:
    print((0))
# Original solution
from functools import reduce
INF = int(1e9+7)


def main():
    N, *An = list(map(int, open(0).read().split()))
    An.sort()
    if N % 2:
        if [0] + [i for i in range(2, N, 2) for j in range(2)] == An:
            print((reduce(lambda x, y: (x << 1) % INF, list(range(N // 2)), 1)))
            return
    else:
        if [i for i in range(1, N, 2) for j in range(2)] == An:
            print((reduce(lambda x, y: (x << 1) % INF, list(range(N // 2)), 1)))
            return
    print((0))
    return


main()


# Optimized solution
INF = int(1e9+7)


def main():
    N, *An = list(map(int, open(0).read().split()))
    An.sort()
    if N % 2:
        if [0] + [i for i in range(2, N, 2) for j in range(2)] == An:
            print((2 ** (N // 2) % INF))
            return
    else:
        if [i for i in range(1, N, 2) for j in range(2)] == An:
            print((2 ** (N // 2) % INF))
            return
    print((0))
    return


main()
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
if n%2==1:
    if a.count(0)==1 and all(a.count(2*i)==2 for i in range(1,n//2+1)):print((2**(n//2)%(10**9+7)))
    else: print((0))
else:
    if all(a.count(2*i+1)==2 for i in range(n//2)):print((2**(n//2)%(10**9+7)))
    else: print((0))

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