#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n + 1];
  int o = 0, e = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if ((a[i] % 2) != 0)
      o++;
    else
      e++;
  }
  cout << min(o, e);
}
int main() {
  solve();
  return 0;
}
