#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, od = 0, ed = 0;
  cin >> n;
  while (n--) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      od++;
    else
      ed++;
  }
  cout << min(od, ed) << endl;
  return 0;
}
