n = int(input())
a = []
b = []
for j in map(int, input().split()):
    if j % 2 == 0:
        a.append(j)
    else:
        b.append(j)
a = sorted(a)[::-1]
b = sorted(b)[::-1]

if abs(len(a) - len(b)) <= 1:
    print(0)
else:
    if len(a) > len(b):
        print(a[0])
    else:
        print(b[0])
