#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  int res = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x % 2 == 0)
      res++;
    else
      cnt++;
  }
  cout << min(res, cnt) << endl;
}
