#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int saver[2001] = {0};
    int oddcounter = 0, evencounter = 0;
    for (int i = 0; i < n; i++) {
      int s;
      cin >> s;
      saver[i] = s % 2;
      if (saver[i])
        oddcounter++;
      else
        evencounter++;
    }
    bool mark = true;
    if (oddcounter == 1 && evencounter == 1) {
      cout << 0 << endl;
      continue;
    }
    if (oddcounter > evencounter) {
      oddcounter--;
    } else {
      evencounter--;
      mark = false;
    }
    while (oddcounter > 0 && evencounter > 0 && mark) {
      evencounter--;
      oddcounter--;
    }
    while (oddcounter > 0 && evencounter > 0 && !mark) {
      oddcounter--;
      evencounter--;
    }
    cout << oddcounter + evencounter << endl;
  }
}
