import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Solution {
    public static Integer INT(String s){
        return Integer.parseInt(s);
    }

    public static Long LONG(String s){
        return Long.parseLong(s);
    }

    //====================================================================================================================

    public static void main(String[] args) throws IOException{

        Scanner sc = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuffer out = new StringBuffer();
        int n = sc.nextInt();
        int[]arr = new int[n/2];
        for(int i=0;i<arr.length;i++){
            arr[i] = sc.nextInt();
        }
        int even=0,odd=0;
        for(int i=0;i<arr.length;i++){
            if(arr[i]%2==0){
                even++;
            }
            else{
                odd++;
            }
        }
        if(odd>even){
            System.out.println((n/2)*2);
        }
        else{
            System.out.println(even);
        }
    }

}