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

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Long n[] = new Long[sc.nextInt()];
		int even = 0;
		int odd = 0;
		for (int i = 0; i < n.length; i++) {
			n[i] = sc.nextLong();
			if (n[i] % 2 == 0) even++;
			else odd++;	
		}
		Arrays.sort(n);
		if(Math.abs(even-odd)>=2) {
			if(odd==0 || even==0) {
				int ans = 0;
				for(int i=0;i<n.length-1;i++) ans += n[i];
				System.out.println(ans);
			}
			else{
				for(int i=0;i<n.length;i++) {
					if(even>odd & n[i]%2==0) {
						System.out.println(n[i]);
						break;
					}
					else if(even<odd & n[i]%2!=0){
						System.out.println(n[i]);
						break;
					}
				}
			}
		} else
			System.out.println(0);
	}
}
// 4 1
	 	    	 		 	 		        		 	 	