Problem:


Score : 300 points

Problem Statement

There are N people, conveniently numbered 1 through N.
They were standing in a row yesterday, but now they are unsure of the order in which they were standing.
However, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.
According to their reports, the difference above for person i is A_i.

Based on these reports, find the number of the possible orders in which they were standing.
Since it can be extremely large, print the answer modulo 10^9+7.
Note that the reports may be incorrect and thus there may be no consistent order.
In such a case, print 0.

Constraints

1≦N≦10^5

0≦A_i≦N-1

Input

The input is given from Standard Input in the following format:

N
A_1 A_2 ... A_N

Output

Print the number of the possible orders in which they were standing, modulo 10^9+7.

Sample Input 1

5
2 4 4 0 2

Sample Output 1

4

There are four possible orders, as follows:

2,1,4,5,3

2,5,4,1,3

3,1,4,5,2

3,5,4,1,2

Sample Input 2

7
6 4 0 2 4 0 2

Sample Output 2

0

Any order would be inconsistent with the reports, thus the answer is 0.

Sample Input 3

8
7 5 1 1 7 3 5 3

Sample Output 3

16



Sample input:
5
2 4 4 0 2


Sample output:
4

Submission status: Runtime Error

Solution code:
import collections
import sys
l = int(input())
inputs = [int(j) for j in input().split(' ')]
cs = collections.Counter(inputs)
if l % 2 == 0:
  for v,c in cs.items():
    if v % 2 == 0 or c != 2:
      print(0)
      sys.exit()
else:
  for v,c in cs.items():
    if v % 2 != 0 or (c != 2 and v != 0):
      print(0)
      sys.exit()
print(2**int(l/2)%(1e9+7))

Submission status: Runtime Error

Solution code:
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
ans=0
if N%2!=0:
    c=list(Counter(A).items())
    c.sort(reverse=True)
    for a,b in c:
        if a!=0 and b==2:
            ans+=1
        elif a==0 and b==1:
            print(2**ans/(10**9+7))
        else:
            print(0)
            break
else:
    if A.count(0)>0:
        print(0)
    else:
        c=list(Counter(A).items())
        c.sort(reverse=True)
        for a,b in c:
            if a!=1 and b==2:
                ans+=1
            elif a==1 and b==2:
                ans+=1
                print(2**ans/(10**9+7))
            else:
                print(0)
                break

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
a = list(map(int, input().split()))
ans = 0
flag = 0
if n % 2 == 1:
  if a.count(0) != 1: flag = 1
  else:
    sa = n-1
    while sa > 0:
      if a.count(sa) != 2:
        print(0)
        sys.exit()
      sa -= 2
else:
  if a.count(0) != 0: flag = 1
  else:
    sa = n-1
    while sa > 0:
      if a.count(sa) != 2:
        print(0
        sys.exit()
      sa -= 2

if flag == 0:
  print(2 ** (n // 2))
else:
  print(0)

Submission status: Runtime Error

Solution code:
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(input().split())
    A.sort()
    if(N==1 and A[0]!=str(0)):
        ans = 0
    else:
        ans = (2**(N//2)) % p
    
    if(N%2 == 1):
        c= A.pop(0)
        if c != str(0):
            print(0)
            exit()
        for i in range(0,2,N):
            if i%2 == 0 and A[i] != str(i+2):
                ans = 0
                break
            if i%2 == 1 and A[i] != str(i+1):
                ans = 0
                break      
    else:
        for i in range(0,2,N):
            if i%2 == 0 and A[i] != str(i+1):
                ans = 0
                break
            if i%2 == 1 and A[i] != str(i):
                ans = 0
                break  
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
A = list(map(int, input().split()))
mod=int(1e9+7)

memo={}
for a in A:
  memo[a]=memo.get(a,0)+1

answer=1
if n%2:
  if memo[0]!=1:
    print(0)
    exit()
  for i in range(1, (n+1)//2):
    if memo[2*i]!=2:
      print(0)
      exit()
    else:
      answer = 2*answer %mod
elif not n%2:
  for i in range(n//2):
    if memo[2*i+1]!=2:
      print(0)
      exit()
    else:
      answer = 2*answer %mod
      
print(answer)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int, input().split()))

if N%2:
  A = A+ [0]

Adict={}
for a in A:
  Adict[a] = Adict.get(a, 0) +1
  
#print(Adict)

# 0,0,2,2,4,4  5   (i//2)*2 + 1- N%2 0,2,4
# 1,1,3,3,5,5  6

#print(range(1-N%2, N, 2))
#print(all([Adict[i]==2 for i in range(1-N%2, N, 2)]))

if all([Adict[i]==2 for i in range(1-N%2, N, 2)]):
  answer = 1
  for _ in range(N//2):
    answer = (answer * 2)%1000000007
  print(answer)
else:
  print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int, input().split()))

if N%2:
  A = A+ [0]
  
print(A)
  
Adict={}
for a in A:
  Adict[a] = Adict.get(a, 0) +1
  
#print(Adict)

# 0,0,2,2,4,4  5   (i//2)*2 + 1- N%2 0,2,4
# 1,1,3,3,5,5  6

#print(range(1-N%2, N, 2))
#print(all([Adict[i]==2 for i in range(1-N%2, N, 2)]))

if all([Adict[i]==2 for i in range(1-N%2, N, 2)]):
  answer = 1
  for _ in range(N//2):
    answer = (answer * 2)%1000000007
  print(answer)
else:
  print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
A=list(map(int, input().split()))

if N%2:
  A = A+ [0]
  
Adict={}
for a in A:
  Adict[a] = Adict.get(a, 0) +1

# 0,0,2,2,4,4  5   (i//2)*2 + 1- N%2 0,2,4
# 1,1,3,3,5,5  6

if all([Adict[i]==2 for i in range(1-N%2, N, 2)]):
  print(2**(N//2))
else:
  print(0)

Submission status: Runtime Error

Solution code:
n = int(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)
    else:
        print(2**(n//2)%mod)
else:
    if a[0]!=0:
        print(0)
    else:
        for i in range(2,n,2):
            if a[i-1]!=i or a[i]!=i:
                print(0)
        else:
            print(2**(n//2)%mod)

Submission status: Runtime Error

Solution code:
n = int(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
lag = 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)

Submission status: Runtime Error

Solution code:
n = int(intput())

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

sa = sorted(a)

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

flag = True

for i,s in enumerate(sa):
  if (i/2)*2+k != s:
    flag = False

if flag:
  print(2**n/2)
else:
  print(0)

Submission status: Runtime Error

Solution code:
n = int(intput())

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

sa = sorted(a)

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

flag = True

for i,s in enumerate(sa):
  if (i/2)*2+k != s:
    flag = false

if flag:
  print(2**n/2)
else:
  print(0)

Submission status: Runtime Error

Solution code:
n = int(intput())

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

sa = sorted(a)

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

flag = True

for i,s in enumerate(sa):
  if (i//2)*2+k != s:
    flag = false

if flag:
  print(2**n//2)
else:
  print(0)

Submission status: Runtime Error

Solution code:
n = int(intput())

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

sa = sorted(a)

if n % 2 == 0;
  k = 0
else;
  k = 1

flag = True

for i,s in enumerate(sa);
  if (i//2)*2+k != s;
    flag = false

if flag;
  print(2**n//2)
else;
  print(0)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
if n % 2 == 0:
    for i in range(1,n+1,2):
        if a[i] != i:
            print(0)
            c = 1
            break
        else:
            if a[i] != a[i-1]:
                print(0)
                c = 1
                break
    if c == 0:
        print(int(2 ** (n / 2)))
else:
    a.insert(0,0)
    for i in range(0,n+1,2):
        if a[i] != i:
            print(0)
            c = 1
            break
        else:
            if a[i] != a[i+1]:
                print(0)
                c = 1
                break
    if c == 0:
        print(int(2 ** ((n-1) / 2)))

Submission status: Runtime Error

Solution code:
n = int(input())

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

b = [0 for i in range(10**5)]

for i in range(n):
    b[a[i]] += 1
if n % 2 == 0:
    if sum(b[::2]) == 0 and all(list(map(lambda x:x==2),b[1::2])):
        print(2**(n//2))
    else:
        print(0)

else:
    print(b[1:n//2:2],list(map(lambda x:x == 2,b[:n//2:2])))
    if sum(b[1::2]) == 0 and all(list(map(lambda x:x == 2,b[::2]))) and b[0] == 1:
        print(2**(n//2))
    else:
        print(0)

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
if n%2==0:
    b=sorted(a)
    i=0
    while i<len(b):
        if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
            print(0)
            exit()
        i+=2
    print((2**(len(b)//2))%(10**9+7))
else:
    b=sorted(a)
    if len(b)>1:
        if b[1]==0:
            print(0)
            exit()
    if b[0]!=0:
        print(0)
        exit()
    else:
        i=1
        while i<len(b):
            if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
                print(0)
                exit()
            i+=2
        print(2**(len(b)//2)%(10**9+7))

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    b=sorted(a)
    i=0
    while i<len(b)-2:
        if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
            print(0)
            exit()
        i+=2
    print((2**(len(b)//2))%(10**9+7))
else:
    b=sorted(a)
    if b[0]!=0 or b[1]==0:
        print(0)
        exit()
    else:
        i=1
        while i<len(b)-2:
            if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
                print(0)
                exit()
            i+=2
        print(2**(len(b)//2)%(10**9+7))

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    b=sorted(a)
    i=0
    while i<len(b)-2:
        if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
            print(0)
            exit()
        i+=2
    if b[-1]!=b[-2]:
        print(0)
        exit()
    print((2**(len(b)//2))%(10**9+7))
else:
    b=sorted(a)
    if b[0]!=0:
        print(0)
        exit()
    else:
        i=1
        while i<len(b)-2:
            if b[i]!=b[i+1] or b[i+2]!=b[i]+2:
                print(0)
                exit()
            i+=2
        if b[-1]!=b[-2]:
            print(0)
            exit()
        print(2**(len(b)//2)%(10**9+7))

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    b=sorted(a)
    i=0
    while i<len(b):
        if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
            print(0)
            exit()
        i+=2
    print((2**(len(b)//2))%(10**9+7))
else:
    b=sorted(a)
    if b[0]!=0:
        print(0)
        exit()
    else:
        i=1
        while i<len(b):
            if not (b[i]==b[i+1] or b[i+2]==b[i]+2):
                print(0)
                exit()
            i+=2
        print(2**(len(b)//2)%(10**9+7))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
ans = 0
flag = True
nums = {}
for a in A:
    if a not in nums:
        nums[a] = 1
    else:
        nums[a] += 1

if n % 2 == 1:
    if nums[0] != 1:
        flag = False
    for i in range(n//2):
        if nums[2*(i+1)] != 2:
            flag = False
            break
else:
    for i in range(n//2):
        if nums[2*i+1] != 2:
            flag = False
            break

if flag == True:
    ans = 2**(n//2)
    ans = ans % (10**9 + 7)
    
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
ans = 0
flag = True
nums = {}
for a in A:
    if a in nums:
        nums[a] += 1
    else:
        nums[a] = 1

if n % 2 == 1:
    if nums[0] != 1:
        flag = False
    for i in range(n//2):
        if nums[2*(i+1)] != 2:
            flag = False
            break
else:
    for i in range(n//2):
        if nums[2*i+1] != 2:
            flag = False
            break

if flag == True:
    ans = 2**(n//2)
    ans = ans % (10**9 + 7)
    
print(ans)

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
ans = 0
flag = True
nums = {}
for a in A:
    if a in nums:
        nums[a] += 1
    else:
        nums[a] = 1

if n % 2 == 1:
    if nums[0] != 1:
        flag = False
    for i in range(n//2):
        if nums[2*(i+1)] != 2:
            flag = False
            break
else:
    for i in range(n//2):
        if nums[2*i+1] != 2:
            flag = False
            break

if flag == True:
    ans = 2**(n//2) % (10**9 + 7)
    
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
d = {}
s = 1
b = 1
m = 1 - n%2
for i in a:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
for i in range(n):
    if i % 2 == m:
        if (i > 0 and d[i] != 2) or (i == 0 and d[i] != 1):
            b = 0
            break
        s *= d[i]
    elif i in d:
        b = 0
        break
if b:
    print(s)
else:
    print(0)

Submission status: Runtime Error

Solution code:
n = int(input())
a = list(map(int, input().split()))
t = [a.count(i) for i in range(n)]
for i in range(n//2):
  if t[i*2+n%2] != 0 or t[i*2+1+n%2] != 2: or t[0] > 1:
    print(0)
    exit()
print(2**(n//2))

Submission status: Runtime Error

Solution code:
N = int(input())
L = list(map(int,input().split()))
L = sorted(L,reverse=True)

flg = 1
for i in range(N) :
    if i % 2 == 0 :
        if L[i] != N-i-1
            flg = 0
            break
    else :
        if L[i] != l
        flg = 0
        break
if flg == 0 :
    ans = 0
else :
    ans = 2**(N//2) % (10**9+7)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))

D = {}
for a in A :
    if a not in D :
        D[a] = 1
    else :
        D[a] += 1
for a in D :
    if N % 2 == 1 :
        if a % 2 != 0 :
            ans = 0
            break
        elif D[a] != 2 :
            if a != 0 :
                ans = 0
                break
        else :
            ans = 2**(len(D)-1)
    else :
        if a % 2 == 0 :
            ans = 0
            break
        elif D[a] != 2 :
            ans = 0
            break
        else :
            ans = 2**(len(D))
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
*a, = map(int, input().split())
a.sort()

if n % 2:
    for k in range(n):
        if a[k] != (k+1)//2*2:
        print(0)
        break
    else:
         print(2**((n-1)//2) % (10**9+7))
else:
    for k in range(n):
        if a[k] != k//2*2+1:
        print(0)
        break
    else:
        print(2**(n//2) % (10**9+7))

Submission status: Runtime Error

Solution code:
n = int(input())
*a, = map(int, input().split())
a.sort()

if n % 2:
    for k in range(n):
        if a[k] != (k+1)//2*2
        print(0)
        break
    else:
         print(2**((n-1)//2) % (10**9+7))
else:
    for k in range(n):
        if a[k] != k//2*2+1
        print(0)
        break
    else:
        print(2**(n//2) % (10**9+7))

Submission status: Runtime Error

Solution code:
n = int(input())
*a, = map(int, input())
a.sort()

if n % 2:
    for k in range(n):
        if a[k] != (k+1)//2*2
        print(0)
        break
    else:
         print(2**((n-1)//2) % (10**9+7))
else:
    for k in range(n):
        if a[k] != k//2*2+1
        print(0)
        break
    else:
        print(2**(n//2) % (10**9+7))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))

d = {}
for i in set(A):
    d[i] = 0

if N % 2 == 1:
    for i in A:
        d[i] += 1
    for k,v in d.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
            continue
        if v != 2:
            print(0)
            exit()
else:
    for i in A:
        d[i] += 1
    for k,v in d.items():
        if k == 0:
            if v != 0:
                print(0)
                exit()
        if v != 2:
            print(0)
            exit()


ans = 2
M = 10**9 + 7
if N % 2 == 1:
    ans = 2**((N-1)/2) % M
else:
    ans = 2**(N/2) % M
print(int(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))

d = {}
for i in set(A):
    d[i] = 0

if N % 2 == 1:
    for i in A:
        d[i] += 1
    for k,v in d.items():
        if k == 0:
            if v != 1:
                print(0)
                exit()
            continue
        if v != 2:
            print(0)
            exit()

else:
    for i in A:
        d[i] += 1
    for k,v in d.items():
        if k == 0:
            if v != 0:
                print(0)
                exit()
        if v != 2:
            print(0)
            exit()


ans = 2
M = 10**9 + 7
if N % 2 == 1:
    ans = 2**((N-1)/2) % M
else:
    ans = 2**(N/2) % M
print(int(ans))
~
~

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))

# N が奇数なら、Aはすべて偶数であり、かつ0を除いてすべて1ペア、かつ0が1つあるはず
# N が偶数なら、Aはすべて奇数であり、かつすべて1ペア
# 上記を確認するための辞書
dic = {}

for a in A:
    if a in dic.keys():
        dic[a] += 1
    else: dic[a] = 1

flag = True
ini = N
if N % 2 == 1:
    if 0 in A:
        if dic[0] == 1:
            ini = 2
        else:
            flag = False
    else:
        flag = False
else:
    ini = 1

for i in range(ini,N,2):
    if not flag: break
    if dic[i] != 2:
        flag = False

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))

dic = {}

for a in A:
    if a in dic.keys():
        dic[a] += 1
    else: dic[a] = 1

flag = True
ini = N
if N % 2 == 1:
    if 0 in A:
        if dic[0] == 1:
            ini = 2
    else:
        flag = False
else:
    ini = 1
    
for i in range(ini,N,2):
    if not flag: break
    if dic[i] != 2:
        flag = False

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int, input().split()))

dic = {}

for a in A:
    if a in dic.keys():
        dic[a] += 1
    else: dic[a] = 1

flag = True
ini = 0
if N % 2 == 1:
    if dic[0] == 1:
        ini = 2
    else:
        flag = False
else:
    ini = 1

flag = True
for i in range(ini,N,2):
    if not flag: break
    if dic[i] != 2:
        flag = False

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

Submission status: Runtime Error

Solution code:
N = int(input())
A = map(int, input().split())
 
L = [abs((N-1) - 2*i) for i in range(N)]
 
L.sort(); A.sort()
 
print(pow(2, (N-N%2)//2, 10**9+7) if L == A else 0)

Submission status: Runtime Error

Solution code:
N = int(input())
A = map(int, input().split())

L = [abs((N-1) - 2*i) for i in range(N)]

L.sort(); A.sort()

print(pow(2, (N-N%2)/2, 10**9+7) if L == A else 0)

Submission status: Runtime Error

Solution code:
N = int(raw_input())
A = map(int, raw_input().split())

L = [ abs((N-1) - 2*i) for i in range(N)]

L.sort(); A.sort()

print(pow(2, (N-N%2)/2, 10**9+7) if L == A else 0)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
ans=True

if n%2!=0:
    zero=0
    [zero+=1 for c in arr if c==0]
    if zero[0]!=1:
    	ans=False
    elif len(set(arr))!=int(n/2)+1:
        ans=False
else:
    if 0 in arr:
        ans=False
    elif len(set(arr))!=int(n/2):
        ans=False

if ans:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
ans=True

if n%2!=0:
    zero=0
    [zero+=1 for c in arr if c==0]
    if zero!=1:
    	ans=False
    elif len(set(arr))!=int(n/2)+1:
        ans=False
else:
    if 0 in arr:
        ans=False
    elif len(set(arr))!=int(n/2):
        ans=False

if ans:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
    for i in range(int(N/2)):    
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+1:
                A.pop(0)
            else:
                miss=1
                break
                
    if miss==1:
        print(0)
    else:
        print(int((2**int(N/2))%(10e9+7)))

else:
    if A[0]!=0:
        miss=1
        A.pop(0)
    else:
        A.pop(0)
    for i in range(int((N-1)/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+2:
                A.pop(0)
            else:
                miss=1
                break
                
    if miss==1:
        print(0)
    else:
        print(int((2**int((N-1)/2))%(10e9+7)))

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
    for i in range(int(N/2)):        
        for j in range(2):
            if A[0]==2*i+1:
                A.pop(0)
            else:
                miss=1
                
    if miss==1:
        print(0)
    else:
        print(int((2**int(N/2))%(10e9+7)))

if N%2==1:
    if A[0]!=0:
        miss=1
        A.pop(0)
    else:
        A.pop(0)
    for i in range(int((N-1)/2)):
        for j in range(2):
            if A[0]==2*i+2:
                A.pop(0)
            else:
                miss=1
                
    if miss==1:
        print(0)
    else:
        print(int((2**int((N-1)/2))%(10e9+7)))

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
    for i in range(int(N/2)):
        if miss==1:
            
        for j in range(2):
            if A[0]==2*i+1:
                A.pop(0)
            else:
                miss=1
                
    if miss==1:
        print(0)
    else:
        print(int((2**int(N/2))%(10e9+7)))

if N%2==1:
    if A[0]!=0:
        miss=1
        A.pop(0)
    else:
        A.pop(0)
    for i in range(int((N-1)/2)):
        if miss==1:
            
        for j in range(2):
            if A[0]==2*i+2:
                A.pop(0)
            else:
                miss=1
                
    if miss==1:
        print(0)
    else:
        print(int((2**int((N-1)/2))%(10e9+7)))

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
ans=True

if n!=0:
    if len(set(arr))!=int(n/2)+1
    ans=False
else:
    if len(set(arr))!=n/2:
    ans=False

if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
    for i in range(int(N/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+1:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int(N/2))%(10e9+7)))

if N%2==1:
    if A[0]!=0:
        miss=1
        A.pop(0)
    else:
        A.pop(0)
    for i in range(int((N-1)/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+2:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int((N-1)/2))%(10e9+7)))

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
    for i in range(int(N/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+1:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int(N/2))%(10e9+7)))

if N%2==1:
    if A[0]!=0:
        miss=1
    else:
        A.pop(0)
    for i in range(int((N-1)/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+2:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int((N-1)/2))%(10e9+7)))

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    for c in range(0,n-1,2):
        if c==0 and dic[c]!=1:
            ans=False
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
    for i in range(int(N/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+1:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int(N/2))%(10e9+7)))

if N%2==1:
    if not 0 in A:
        miss=1
    else:
        A.pop(0)
    for i in range(int((N-1)/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+2:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int((N-1)/2))%(10e9+7)))

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
    if dic[0]!=1:
        ans=False
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
miss=0
if N%2==0:
    for i in range(int(N/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+1:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int(N/2))%(10e9+7)))

if N%2==1:
    if not 0 in A:
        miss=1
    else:
        A.pop(0)
    for i in range(int((N-1)/2)):
        if miss==1:
            break
        for j in range(2):
            if A[0]==2*i+2:
                A.pop(0)
            else:
                miss=1
                break
    if miss==1:
        print(0)
    else:
        print(int((2**int((N-1)/2))%(10e9+7)))

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    if dic[0]!=1:
        ans=False
        print(0)
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans and n!=0:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
arr=list(map(int,input().split()))
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    if dic[0]!=1:
        ans=False
        print(0)
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans:
    print(2**math.floor(n/2)%((10**9)+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
arr=list(map(int,input().split()))
n=len(arr)
dic={}
for c in arr:
    dic.setdefault(c,0)
    dic[c]+=1
ans=True
print(dic)
#n is odd 5(4 2 0 2 4)
if n%2!=0:
    if dic[0]!=1:
        ans=False
    for c in range(2,n-1,2):
        if dic[c]!=2:
            ans=False
            break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
    for c in range(1,n-1,2):
        if dic[c]!=2:
            ans=False
if ans:
    print(2**int(n/2)%(10**9+7))
else:
    print(0)

Submission status: Runtime Error

Solution code:
n=int(input())
arr=list(map(int,input().split()))
n=len(arr)
dic={}
for c in arr:
  dic.setdefault(c,0)
  c+=1
ans=True
#n is odd 5(4 2 0 2 4)
if n%2!=0:
  if dic[0]!=1:
    ans=False
  for c in range(2,n-1,2):
      if dic[c]!=2:
        ans=False
        break
#n is even 8 (7 5 1 1 7 3 5 3)        
else:
  for c in range(1,n-1,2):
    if dic[c]!=2:
      ans=False
if ans:
  print(2**int(n/2)/10**9+7)
else:
  print(0)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [int(i) for i in input().split()]

# aの各数値の個数をdictで保持(数値:個数) 
a_dict = {}
for v in a:
    if v in a_dict:
        a_dict[v] += 1
    else:
        a_dict[v] = 1

# a_dictの中になければならない数値のリストを作成
possible_list = {i: True for i in range(1, n, 2)}
 
can = True
if n % 2 == 0:
    for k, v in a_dict.items():
        # 数値が2個でない、もしくはkがpossible_list内に存在しないならFalse
        if v != 2 or k not in possible_list:
            can = False
            break
else:
　　　　if a_dict[0] != 1:
        can = Falsen = int(input())
a = [int(i) for i in input().split()]

# aの各数値の個数をdictで保持(数値:個数) 
a_dict = {}
for v in a:
    if v in a_dict:
        a_dict[v] += 1
    else:
        a_dict[v] = 1

# a_dictの中になければならない数値のリストを作成(0以外)
 
if n % 2 == 0:
    possible_list = {i: True for i in range(1, n, 2)}
    for k, v in a_dict.items():
        # 2個でない、もしくはpossible_list内に存在しない数値ならFalse
        if v != 2 or k not in possible_list:
            print(0)
            exit()
else:
    possible_list = {i: True for i in range(0, n, 2)}
    if a_dict[0] != 1:
        print(0)
        exit()
    else:
        a_dict[0] = 2
        for k, v in a_dict.items():
            if v != 2 or k not in possible_list:
                print(0)
                exit()
 
print(2 ** (n // 2) % (10 ** 9 + 7))
    else:
        for k, v in a_dict.items():
            if v != 2 or k not in possible_list:
                can = False
                break
 
if can:
    print(2 ** (n // 2) % (10 ** 9 + 7))
else:
    print(0)