Buggy python submission (verdict: Time Limit Exceeded):
N = int(raw_input())
A = list(map(int,raw_input().split()))
MOD = 10**9 + 7
def calc(a):
	if 0 in a:
		if a.count(0) != 1:
			return 0
		a.remove(0)
		b = [a.count(i*2) for i in range(1,int(N/2) + 1)]
		if b.count(2) != int(N/2):
			return 0
	else:
		b = [a.count(i*2-1) for i in range(1,int(N/2) + 1)]
		if b.count(2) != int(N/2):
			return 0

	return 2 ** int(N/2)

print(calc(A) % MOD)

Fixed submission:
N = int(raw_input())
A = list(map(int,raw_input().split()))
A.sort()
MOD = 10**9 + 7
def calc(a):
	if N % 2 == 0:
		B = [int(i/2)*2 + 1 for i in range(0,N)]
		if A != B:
			return 0
	else:
		B = [int(i/2)*2 for i in range(1,N+1)]
		if A != B:
			return 0
	return 2 ** int(N/2)

print(calc(A) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(raw_input())
A = list(map(int,raw_input().split()))
MOD = 10**9 + 7
def calc(a):
	if 0 in a:
		if a.count(0) != 1:
			return 0
		a.remove(0)
		b = [a.count(i*2) for i in range(1,int(N/2) + 1)]
		if b.count(2) != int(N/2):
			return 0
	else:
		b = [a.count(i*2-1) for i in range(1,int(N/2) + 1)]
		if b.count(2) != int(N/2):
			return 0

	return 2 ** int(N/2)
if N % 2 is 0:
	if len(filter(lambda n:n%2==0, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)
else:
	if len(filter(lambda n:n%2==1, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)

Fixed submission:
N = int(raw_input())
A = list(map(int,raw_input().split()))
A.sort()
MOD = 10**9 + 7
def calc(a):
	if N % 2 == 0:
		B = [int(i/2)*2 + 1 for i in range(0,N)]
		if A != B:
			return 0
	else:
		B = [int(i/2)*2 for i in range(1,N+1)]
		if A != B:
			return 0
	return 2 ** int(N/2)

print(calc(A) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(raw_input())
A = list(map(int,raw_input().split()))
MOD = 10**9 + 7
def calc(a):
	if 0 in a:
		if a.count(0) != 1:
			return 0
		for i in [x*2 for x in range(1,int(N/2) + 1)]:
			if a.count(i) != 2:
				return 0
	else:
		for i in [x*2 - 1 for x in range(1,int(N/2) + 1)]:
			if a.count(i) != 2:
				return 0
	return 2 ** int(N/2)
if N % 2 is 0:
	if len(filter(lambda n:n%2==0, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)
else:
	if len(filter(lambda n:n%2==1, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)

Fixed submission:
N = int(raw_input())
A = list(map(int,raw_input().split()))
A.sort()
MOD = 10**9 + 7
def calc(a):
	if N % 2 == 0:
		B = [int(i/2)*2 + 1 for i in range(0,N)]
		if A != B:
			return 0
	else:
		B = [int(i/2)*2 for i in range(1,N+1)]
		if A != B:
			return 0
	return 2 ** int(N/2)

print(calc(A) % MOD)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9 + 7
def calc(a):
	if 0 in a:
		if a.count(0) != 1:
			return 0
		for i in [x*2 for x in range(1,int(N/2) + 1)]:
			if a.count(i) != 2:
				return 0
	else:
		for i in [x*2 - 1 for x in range(1,int(N/2) + 1)]:
			if a.count(i) != 2:
				return 0
	return 2 ** int(N/2)
if N % 2 is 0:
	if len(filter(lambda n:n%2==0, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)
else:
	if len(filter(lambda n:n%2==1, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)

Fixed submission:
N = int(raw_input())
A = list(map(int,raw_input().split()))
A.sort()
MOD = 10**9 + 7
def calc(a):
	if N % 2 == 0:
		B = [int(i/2)*2 + 1 for i in range(0,N)]
		if A != B:
			return 0
	else:
		B = [int(i/2)*2 for i in range(1,N+1)]
		if A != B:
			return 0
	return 2 ** int(N/2)

print(calc(A) % MOD)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9 + 7
def calc(a):
	if 0 in a:
		if a.count(0) != 1:
			return 0
		for i in [x*2 for x in range(1,int(N/2) + 1)]:
			if a.count(i) != 2:
				return 0
	else:
		for i in [x*2 - 1 for x in range(1,int(N/2) + 1)]:
			if a.count(i) != 2:
				return 0
	return 2 ** int(N/2)
if N % 2 is 0:
	if len(filter(lambda n:n%2==0, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)
else:
	if len(filter(lambda n:n%2==1, A)) > 0:
		print(0)
	else:
		print(calc(A) % MOD)

Fixed submission:
N = int(raw_input())
A = list(map(int,raw_input().split()))
A.sort()
MOD = 10**9 + 7
def calc(a):
	if N % 2 == 0:
		B = [int(i/2)*2 + 1 for i in range(0,N)]
		if A != B:
			return 0
	else:
		B = [int(i/2)*2 for i in range(1,N+1)]
		if A != B:
			return 0
	return 2 ** int(N/2)

print(calc(A) % MOD)