#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, k, p, s, x, y, m, t, b, c, mini, maxi, sum, d, ans, a,
      e = 0, f, o = 0, q = 0, a1, a2, b1, b2, a3, b3, nl, np, l, n1, n2;
  vector<int> v;
  vector<int>::iterator it;
  vector<long long> v1;
  ios ::sync_with_stdio(false);
  cin.tie(0);
  ;
  string s1, s2;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    if (x % 2 == 0) {
      e++;
    } else {
      o++;
    }
  }
  mini;
  mini = min(e, o);
  cout << mini;
  return 0;
}
