#include <bits/stdc++.h>
using namespace std;
const long long INF = 10E16;
const long long mask = (1 << 9) - 1;
const long long base = 100000000000;
const long double eps = 0.0000001;
struct pp {
  long long fi, sc;
  bool const operator<(const pp& b) {
    if (fi == b.fi) return sc < b.sc;
    return fi < b.fi;
  }
  bool const operator>(const pp& b) {
    if (fi == b.fi) return sc > b.sc;
    return fi > b.fi;
  }
  bool const operator==(const pp& b) {
    if (fi == b.fi && sc == b.sc) return 1;
    return 0;
  }
};
bool const operator<(const pp& a, const pp& b) {
  if (a.fi == b.fi) return a.sc < b.sc;
  return a.fi < b.fi;
}
long long n;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  long long r1 = 0, r2 = 0;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    if (x % 2 == 1)
      r1++;
    else
      r2++;
  }
  cout << min(r1, r2) << endl;
  return 0;
}
