import java.util.*;

public class Practise {

    static int[][] dp;

    static long sum=0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr= new int[n];
        int even=0;
        int odd=0;
        for(int i=0;i<n;i++)
        {
            int a=sc.nextInt();
            if(a%2==0)
                even++;
            else
                odd++;

            arr[i]=a;
        }
        Arrays.sort(arr);
       // System.out.println(Arrays.toString(arr));
        boolean tt=true;
       // System.out.println(odd+" "+even);
        if(arr[n-1]%2==0)
            tt=true;
        else
            tt=false;

        for(int i=n-1;i>=0;i--){

           if(arr[i]%2==0 && even>0 && tt){
               even--;
               arr[i]=0;
               tt=false;
           }else if(odd>0 && arr[i]%2!=0 && !tt){
               odd--;
               arr[i]=0;
               tt=true;

           }

        }
        //System.out.println(Arrays.toString(arr));
        int sum=0;
        for(int a:arr){
            sum+=a;
        }
        System.out.println(sum);











    }

    private static boolean funn(int[] arr, int mid,int k) {
        return (sum/mid)/mid>=k;







    }

    private static int numberofsumsubset(int[] arr, int i,int sum) {
        if(i<0)
            return 0;
        if(sum==0)
            return 1;
        if(sum<0)
            return 0;
        return numberofsumsubset(arr,i-1,sum)+numberofsumsubset(arr,i-1,sum-arr[i])  ;
    }

    private static long numberOfways(long n) {
        if(n<=0)
            return 0;
        if(n==1)
            return 2;
        if(n==2)
            return 3;

        return ((numberOfways(n-1)+numberOfways(n-2))%1000000007);
    }

    private static boolean fun(int mid, int[] ar,int m) {
        long ans=0;
        for(int i=0;i<ar.length;i++){
            if(ar[i]>mid){
                ans+=(ar[i]-mid);
            }
        }
        return ans>=m;
    }

    public static double maxAverageRatio(int[][] classes, int extraStudents) {
        classes[2][1]+=extraStudents;
        classes[2][0]+=extraStudents;
        double ans=0;
        for(int i=0;i<classes.length;i++){
            ans+=(classes[i][0])/(double)(classes[i][1]);
        }
        ans=ans/(double) (classes.length);
        return ans;


    }
}
	 	 		   	 			 		     		  				