import java.util.Scanner;

public class A {

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

        System.out.println(Math.abs(even-odd)-n%2);

    }
}
