import math
n = int(input())
a = input().split(" ")
k1 = 0
k2 = 0
for i in range(n):
    if int(a[i]) % 2 == 0:
        k1 += 1
    else:
        k2 += 1
if abs(k2-k1) > 1:
    t = [k2, k1]
    l = t.index(min(t))
    print(a[l])
else:
    print(0)
