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

public class JavaApplication6 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        
        int[] Chet = new int[n];
        int[] nChet = new int[n];
        Chet[0] = -1;
        nChet[0] = -1;
        int a = 0;
        int b = 0;
        
        for (int i = 0; i < n; i++) {
            int k = scan.nextInt();
            if (k % 2 == 0) {
                Chet[a] = k;
                a++;
            }
            else {
                nChet[b] = k;
                b++;
            }
        }
        
        Arrays.sort(Chet);
        Arrays.sort(nChet);
        
        int sum = 0;
        
        if (Chet[0] == -1) {
            for (int i = 0; i < b - 1; i++) {
                sum += nChet[i];
            }
        }
        else if (nChet[0] == -1) {
            for (int i = 0; i < a - 1; i++) {
                sum += Chet[i];
            }
        }
        else {
            if (b > a) {
            for (int i = 0; i < (b - a); i++) {
                sum += nChet[i];
                }
            }
            else {
            for (int i = 0; i < a - b; i++) {
                sum += Chet[i];
            }
        }
        }
        
        
        
        
        System.out.println(sum);
    }
    
}