#include <iostream>
using namespace std;
int a[200005];
int main() {
    int n, odd = 0, even = 0;
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i], odd += (a[i] % 2 == 0), even += (a[i] % 2 == 1);
 //   cout << odd << " " << even << endl;
    if(odd == 0 || even == 0)
        cout << "0" << endl;
    else if(even % 2 == 0)
        cout << n - 2 << endl;
    else
        cout << n - 1 << endl;
    return 0;
}

