Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
M = N//2
if N % 2 == 1 and A.count(0) == 1 and all(A.count(i*2)==2 for i in range(1,M-1)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(A.count(i*2-1)==2 for i in range(1, M-1)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
M = N//2
if N % 2 == 1 and A.count(0) == 1 and all(A.count(i*2+2)==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(A.count(i*2+1)==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
M = N//2
if N % 2 == 1 and A.count(0) == 1 and all(A.count(i*2+2)==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(A.count(i*2+1)==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
M = N//2
if N % 2 == 1 and A.count(0) == 1 and all(A.count(i*2+2)==2 for i in range(N//2)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(A.count(i*2+1)==2 for i in range(N//2)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

N = int(input())
A = list(map(int, input().split()))
if N % 2 == 1 and A.count(0) == 1 and np.all(A.count(i*2+2)==2 for i in range(N//2)):
    print(int(math.fmod(math.pow(2, N//2), (math.pow(10, 9) + 7))))
elif N % 2 == 0 and np.all(A.count(i*2+1)==2 for i in range(N//2)):
    print(int(math.fmod(math.pow(2, N//2), (math.pow(10, 9) + 7))))
else:
    print(0)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

N = int(input())
A = list(map(int, input().split()))
if N % 2 == 1 and A.count(0) == 1 and np.all(A.count(i*2+2)==2 for i in range(N//2)):
    print(np.int64(np.remainder(math.pow(2, N//2), (math.pow(10, 9) + 7))))
elif N % 2 == 0 and np.all(A.count(i*2+1)==2 for i in range(N//2)):
    print(np.int64(np.remainder(math.pow(2, N//2), (math.pow(10, 9) + 7))))
else:
    print(0)

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
if N % 2 == 1 and (A.count(0) != 1 or not all(A.count(i*2+2)==2 for i in range(N//2))):
    print(0)
elif N % 2 == 0 and not all(A.count(i*2+1)==2 for i in range(N//2)):
    print(0)
else:
    print(2**(N//2) % (10**9 + 7))

Fixed submission:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)