n = int(input())
a = [int(i) for i in input().split()]

even, odd = 0, 0
min_even, min_odd = int(1e9), int(1e9)

for i in a:
    if i % 2 == 0:
        even += 1
        min_even = min(min_even, i)
    else:
        odd += 1
        min_odd = min(min_odd, i)
        
if abs(even - odd) <= 1:
    print(0)
else:
    if even > odd:
        print(min_even)
    else:
        print(min_odd)

