import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), r = n;
        ArrayList<Long> a = new ArrayList<>();
        int countE = 0, countO = 0;
        for (int i = 0; i < n; i++) {
            a.add(in.nextLong());
            if (a.get(i) % 2 == 0) countE++;
            else countO++;
        }
        boolean even = false;
        if (countE > countO) even = true;
        Collections.sort(a, Collections.reverseOrder());
        for (int i = 0; i < n && a.size() > 1; ) {
            if (even && a.get(i) % 2 == 0) {
                a.remove(i);
                even = false;
                i = 0;
                n--;
            } else if (!even && a.get(i) % 2 != 0) {
                a.remove(i);
                even = true;
                i = 0;
                n--;
            } else if (even && a.get(i) % 2 != 0) {
                i++;
            } else if (!even && a.get(i) % 2 == 0) {
                i++;
            }
        }
        System.out.println(a.size() < 2 && r > 2 ? 0 : a.stream().mapToLong(i -> i).sum());
    }
}

