n = int(input())
a = []
a = list(map(int,input().split()))
def CountingEvenOdd(arr, arr_size):
    even_count = 0
    odd_count = 0
 
    # loop to read all the values
    # in the array
    for i in range(arr_size):
 
        # checking if a number is
        # completely divisible by 2
        if (arr[i] & 1 == 1):
            odd_count += 1
        else:
            even_count += 1
 
    return(odd_count)    


def minimum(a, n): 
  
    # inbuilt function to find the position of minimum  
    minpos = a.index(min(a)) 
      
    # inbuilt function to find the position of maximum  
    maxpos = a.index(max(a))  
      
    # printing the position  
    
    return(minpos + 1)
    
m = len(a)
# Function Call
t = CountingEvenOdd(a, m)   


if abs(t-(n-t))==1:
    print(0)  
elif abs(t-(n-t))==0:
    print(0)        
else:
    print(min(a))
