import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.LinkedList;

public class Main {
    static BigInteger[] dp = new BigInteger[10000];

    static BigInteger fib(int n) {
        n -= 1;
        if (n <= 1) return BigInteger.ONE;
        if (dp[n] != null) return dp[n];
        dp[0] = BigInteger.ONE;
        dp[1] = BigInteger.ONE;
        dp[n] = dp[n-1].add(dp[n-2]);
        return dp[n];
    }
    static long solve(int n) {
        if(n<=2) return n*2;
        long [] dp = new long[n];
        dp[0] = 2;
        dp[1] = 4;
        dp[2] = 7;
        int numberOfWhite = 1;
        for (int i = 3; i < n; i++) {
            dp[i] = (dp[i-1]-numberOfWhite)*2 + 1;
            numberOfWhite*=2;
        }
        return dp[n-1];
    }
    private static int convert(int first, int second) {
        int k = 1;
        int equation = second-first+k*26;
        while(equation<97) {
            k++;
            equation = second-first+k*26;
        }
        return equation;
    }
    private static boolean check(int n) {
        return n>=97 && n<=122;
    }
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        InputReader.OutputWriter out = new InputReader.OutputWriter(outputStream);



        int n = in.nextInt();
        int [] a = new int[n];
        int even = 0;
        int odd = 0;
        int minEven = Integer.MAX_VALUE;
        int minOdd = Integer.MAX_VALUE;
        for (int i = 0; i < a.length; i++) {
            a[i] = in.nextInt();
            if(a[i]%2==0) {
                even++;
                minEven = Math.min(minEven,a[i]);
            }
            else {
                odd++;
                minOdd = Math.min(minOdd,a[i]);
            }
        }
        if(Math.abs(even-odd) <= 1) out.println(0);
        else {
            out.println(Math.min(minEven,minOdd));
        }




        out.flush();

    }
    private static boolean isTheSame(char [] c) {
        Arrays.sort(c);
        for (int i = 0; i < c.length - 1; i++) {
            if(c[i+1] - c[i]!=1) return false;
        }
        return true;
    }
    private static int solveToCheck(int n) {
        int max= Integer.MIN_VALUE;
        int number = 1;
        for (int i = 1; i <=n; i++) {
            if(product(i) > max) {
                max = product(i);
                number = i;
            }
        }
        return max;
    }
    private static int product(int n) {
        int p = 1;
        while (n>0) {
            p*=n%10;
            n/=10;
        }
        return p;
    }
    private static void reverseTheString(char [] s, int i, int j) {
        if(i == j) return;
        char temp = s[i];
        s[i] = s[j];
        s[j] = temp;
        i++;
        j--;
        reverseTheString(s,i,j);
    }
    public static String reverseString(String str){

        if(str.isEmpty()){
            return str;
        } else {
            System.out.println(str.substring(1) + str.charAt(0));
            return reverseString(str.substring(1))+str.charAt(0);
        }
    }

    private static void shuffleAnArray(int [] a) {
        for (int i = 0; i < a.length; i++) {
            int index = (int)Math.random()*a.length;
            int temp = a[i];
            a[i] = a[index];
            a[index] = temp;
        }
    }
    public static List<String> commonChars(String[] A) {
        int [][] freqs = new int[A.length][26];
        for(int i=0;i<freqs.length;i++) {
            freqs[i] = freq(A[i]);
        }
        List<String> result = new ArrayList<>();
        for(int i=0;i<26;i++) {
            boolean exit = false;
            int min = Integer.MAX_VALUE;
            for(int j=0;j<freqs.length;j++) {
                if(freqs[j][i]==0) {
                    exit = true;
                    break;
                }
                else {
                    min = Math.min(min,freqs[j][i]);
                }
            }
            if(!exit) {
                for(int k=0;k<min;k++) {
                    char c = (char)(i + 'a');
                    result.add(Character.toString(c));
                }
            }
        }
        return result;
    }
    static int [] freq (String a) {
        int [] frequency = new int[26];
        for(char c : a.toCharArray()) {
            frequency[c-'a']++;
        }
        return frequency;
    }

    static void printMap(LinkedHashMap<Integer,Integer> map) {
        for (Map.Entry<Integer,Integer> m : map.entrySet()) {
            System.out.println(m.getKey() + " " + m.getValue());
        }
    }

    static int upperBound(int [] arr, int target) {
        int lo = 0;
        int hi = arr.length - 1;
        while(lo<=hi) {
            int med = hi-(hi-lo)/2;
            if(target>=arr[med]) lo = med + 1;
            else hi = med - 1;
        }
        return hi;
    }
    static int currentDrawBack(int a,int b,int c, int d) {
        int max = Math.max(a,b);
        int min = Math.min(c,d);
        return min-max+1;
    }
    static int lowerBound1(Integer [] a,int target) {
        int lo = 0;
        int hi = a.length - 1;
        while(lo<=hi) {
            int med = hi-(hi-lo)/2;
            if(target<=a[med]) hi = med - 1;
            else lo = med + 1;
        }
        return lo;
    }
    static int lowerBound(int [] a,int target) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo<=hi) {
            int med = hi-(hi-lo)/2;
            if(target<=a[med]) {
                hi = med - 1;
            }
            else {
                lo = med + 1;
            }
        }
        return lo;
    }

    private static void reverse(char [] c, int k, int index) {
        for(int i=index;i<(2*index+k)/2;i++) {
            System.out.println(i + " " + (k-index - 1));
            char temp = c[i];
            c[i] = c[k-i-1];
            c[k-i-1] = temp;
        }

    }
    static boolean isVowel(char c) {
        return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
    }
    private static String whoWin(int [] a) {
        TreeMap<Integer,Integer> map = new TreeMap<>(Comparator.reverseOrder());
        for(int n:a) {
            map.put(n,map.getOrDefault(n,0)+1);
        }
        for(Map.Entry<Integer,Integer> m:map.entrySet()) {
            if(m.getValue()%2==1) return "Conan";
        }
        return "Agasa";
    }


    private static int [] prefixSum(int [] a) {
        int [] prefix = new int[a.length+1];
        for(int i=1;i < prefix.length;i++) {
            prefix[i] = prefix[i-1] + a[i-1];
        }
        return prefix;
    }
    private static int [] charFrequency(String a) {
        int [] freq = new int[26];
        char [] cc = a.toCharArray();
        for(char c : cc) {
            freq[c-'a']++;
        }
        return freq;
    }
}

class InputReader extends BufferedReader {
    StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        super(new InputStreamReader(inputStream), 32768);
    }

    public InputReader(String filename) {
        super(new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(filename)));
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.valueOf(next());
    }
    public Long nextLong() {return  Long.valueOf(next());}

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

        public OutputWriter(String filename) throws FileNotFoundException {
            super(filename);
        }

        public void close() {
            super.close();
        }
    }
}
