#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, x, k = 0;
  cin >> n;
  vector<int> a;
  for (i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  for (i = 0; i < n; i++) {
    if (a[i] % 2 != 0) k++;
  }
  int y = min(k, n - k);
  cout << y << "\n";
  return 0;
}
