import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        int even = 0; //ch
        int odd = 0; //nech
        int minEven = Integer.MAX_VALUE;
        int minOdd = Integer.MAX_VALUE;
        int[]m = new int[n];
        for(int i=0;i<n;i++){
            m[i]=sc.nextInt();
            if(m[i]%2==0){
                even++;
                minEven = Math.min(minEven,m[i]);
            }else{
                odd++;
                minOdd = Math.min(minOdd,m[i]);
            }
            
        }
        //System.out.println(even+" "+odd);
        if(Math.abs(even-odd)<2){
            System.out.println(0);
        }else{
            if (even > odd) {
                System.out.println(minEven);
            }else{
                System.out.println(minOdd);
            }
        }
    }
}
