n=int(raw_input())

a=raw_input().split(" ")

a=[int(item) for item in a]

even=[]
odd=[]

i=0
while i<n:
    if a[i]%2==0:
        even.append(a[i])
    else:
        odd.append(a[i])
    i+=1
   
diff=abs(len(even)-len(odd))
if diff==0 or diff ==1:
    print(0)
else:
    if len(even)==0:
        print(min(odd))
    elif len(odd)==0:
        print(min(even))
    else:
        print(min([min(even),min(odd)]))