#include <bits/stdc++.h>
using namespace std;
int getDaysOfMonth(int m) {
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
    return 31;
  if (m == 2) return 28;
  return 30;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, cnt = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    cnt += x & 1;
  }
  cout << min(cnt, n - cnt) << endl;
  return 0;
}
