#include <bits/stdc++.h>
using namespace std;
unsigned long long fPow(unsigned long long a, unsigned long long b) {
  unsigned long long x = 1;
  while (b >= 1) {
    if (b & 1) x *= a;
    a *= a;
    b >>= 1;
  }
  return x;
}
int main() {
  int n, o = 0, e = 0;
  scanf("%d", &n);
  vector<int> m(n);
  vector<pair<int, int> > f;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &m[i]);
    if (m[i] & 1)
      o++;
    else
      e++;
  }
  if (e > o)
    cout << o;
  else
    cout << e;
  int ans = 0;
  return 0;
}
