import java.io.*;
import java.util.ArrayList;

public class Main {
    private void solve() {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(br.readLine());

            String[] s = br.readLine().split(" ");
            ArrayList<Integer> odd = new ArrayList<>();
            ArrayList<Integer> even = new ArrayList<>();

            for (int i = 0; i < s.length; ++i) {
                if (Integer.parseInt(s[i]) % 2 == 0) {
                    even.add(Integer.parseInt(s[i]));
                } else {
                    odd.add(Integer.parseInt(s[i]));
                }
            }

            int evenSize = even.size();
            int oddSize = odd.size();

            if (evenSize - oddSize > 1) {
                int min = 1000001;
                for (Integer i : even) {
                    min = Math.min(min, i);
                }

                System.out.println(min);
            } else if (oddSize - evenSize > 1) {
                int min = 1000001;
                for (Integer i : odd) {
                    min = Math.min(min, i);
                }

                System.out.println(min);
            } else {
                System.out.println("0");
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}