import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class B {

	public static HashMap<String, Integer> memo = new HashMap<String, Integer>();
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int size = scan.nextInt();
		int[] nums = new int[size];

		int sum = 0;
		for (int i = 0; i < size; i++) {
			nums[i] = scan.nextInt();
			sum += nums[i];
		}

		int best = go(nums, sum);
		System.out.println(best);
	}

	public static int go(int[] nums, int sum) {

		if (nums.length > 1)
			return Math.min(go2(nums, 0, sum), go2(nums, 1, sum));

		return 0;
	}

	public static int go2(int[] nums, int parity, int sum) {

//		System.out.println(parity + " " + Arrays.toString(nums) + " " + sum);
		
		String k = Arrays.toString(nums);
		if(memo.containsKey(k))
			return memo.get(k);
		
		boolean ran = false;
		int best = Integer.MAX_VALUE;

		for (int i = 0; i < nums.length; i++) {
			if (nums[i] != -1 && nums[i] % 2 == parity) {
								
				ran = true;
				int t = nums[i];
				nums[i] = -1;
				int r = go2(nums, 1 - t % 2, sum - t);
				nums[i] = t;
				best = Math.min(best, r);
			}
		}
		
		if (ran) {
			memo.put(k, best);
			return best;
		}
		
		memo.put(k, sum);
		return sum;

	}

}
