import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class p1 {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int n = in.nextInt();

        int[] a = new int[n];

        int odd = 0;
        int even = 0;

        int count = 0;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            if (a[i] % 2 == 0) {
                even++;
            } else {
                odd++;
            }
        }


        if (odd > even) {
            count = n - even * 2 + 1;
        } else if (odd < even){
            count = n - odd * 2 + 1;
        } else {
            count = n - (odd + even);
        }

        System.out.println(count);

    }

}
