Buggy python submission (verdict: Runtime Error):
num =int(input())

val = [int(x) for x in input().split()]

_len = len(val)
sort_val = sorted(val)
set_val = set(sort_val)

res = True

if len(sort_val) %2 != 0 and sort_val[1] == 0:
    res = False
elif len(sort_val) %2 != 0 and sort_val[1] != 0:
    sort_val = sort_val[1:]
    set_val.remove(0)

if res:
    for i in set_val:
        if len(sort_val) == 2 and sort_val[0] == sort_val[1]:
            break
        if sort_val[2] == i:
            res = False
            break
        else:
            sort_val = sort_val[2:]


cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)


Fixed submission:
num =int(input())

val = [int(x) for x in input().split()]

_len = len(val)
sort_val = sorted(val)
res = False

if len(sort_val) %2 == 0:
    tmp = sort_val[1::2]
    tmp2 = sort_val[::2]
    if sorted(tmp) == sorted(tmp2):
        res = True
else:
    if sort_val.count(0) != 1:
        pass
    else:
        del sort_val[0]
        tmp = sort_val[::2]
        tmp2 = sort_val[1::2]
        if sorted(tmp) == sorted(tmp2):
            res = True

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)

Buggy python submission (verdict: Time Limit Exceeded):
num =int(input())

val = [int(x) for x in input().split()]

_len = len(val)
sort_val = sorted(val)
set_val = set(sort_val)

res = True

if len(val) %2 != 0 and sort_val.count(0) != 1:
    res = False
elif len(val) %2 != 0 and sort_val.count(0) == 1:
    val = val[1:]
    set_val.remove(0)

for i in set_val:
    if sort_val.count(i) != 2:
        res = False
        break
    else:
        sort_val = sort_val[2:]

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)


Fixed submission:
num =int(input())

val = [int(x) for x in input().split()]

_len = len(val)
sort_val = sorted(val)
res = False

if len(sort_val) %2 == 0:
    tmp = sort_val[1::2]
    tmp2 = sort_val[::2]
    if sorted(tmp) == sorted(tmp2):
        res = True
else:
    if sort_val.count(0) != 1:
        pass
    else:
        del sort_val[0]
        tmp = sort_val[::2]
        tmp2 = sort_val[1::2]
        if sorted(tmp) == sorted(tmp2):
            res = True

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)

Buggy python submission (verdict: Time Limit Exceeded):
num =int(input())

val = [int(x) for x in input().split()]

sort_val = sorted(val)
set_val = set(sort_val)

res = True

if len(val) %2 != 0:
    for i in set_val:
        if (i == 0 and sort_val.count(i) != 1) or (i != 0 and sort_val.count(i) %2 != 0):
            res = False
            break
else:
    for i in set_val:
        if sort_val.count(0) != 0 or sort_val.count(i) %2 != 0:
            res = False
            break

cnt = 1
if res:
    for i in range(0, len(sort_val)//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)


Fixed submission:
num =int(input())

val = [int(x) for x in input().split()]

_len = len(val)
sort_val = sorted(val)
res = False

if len(sort_val) %2 == 0:
    tmp = sort_val[1::2]
    tmp2 = sort_val[::2]
    if sorted(tmp) == sorted(tmp2):
        res = True
else:
    if sort_val.count(0) != 1:
        pass
    else:
        del sort_val[0]
        tmp = sort_val[::2]
        tmp2 = sort_val[1::2]
        if sorted(tmp) == sorted(tmp2):
            res = True

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)

Buggy python submission (verdict: Time Limit Exceeded):
num =int(input())

val = [int(x) for x in input().split()]

sort_val = sorted(val)
set_val = set(sort_val)

res = True

if len(val) %2 != 0:
    for i in set_val:
        if (i == 0 and sort_val.count(i) != 1) or (i != 0 and sort_val.count(i) %2 != 0):
            res = False
            break
else:
    for i in set_val:
        if sort_val.count(0) != 0 or sort_val.count(i) %2 != 0:
            res = False
            break

cnt = 1
for i in range(0, len(sort_val)//2):
    cnt = cnt*2 % 1000000007

print(0 if res == False else cnt)

Fixed submission:
num =int(input())

val = [int(x) for x in input().split()]

_len = len(val)
sort_val = sorted(val)
res = False

if len(sort_val) %2 == 0:
    tmp = sort_val[1::2]
    tmp2 = sort_val[::2]
    if sorted(tmp) == sorted(tmp2):
        res = True
else:
    if sort_val.count(0) != 1:
        pass
    else:
        del sort_val[0]
        tmp = sort_val[::2]
        tmp2 = sort_val[1::2]
        if sorted(tmp) == sorted(tmp2):
            res = True

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)