#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  fast();
  long long t, n, i, j, k, x, y, c, m;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i += 1) cin >> a[i];
  ;
  sort(a, a + n);
  long long odd = 0, even = 0;
  long long oddmax = LLONG_MIN, evenmax = LLONG_MIN, cntoddmax = 0,
            cntevenmax = 0;
  for (long long i = 0; i < n; i += 1) {
    if (a[i] & 1) {
      odd++;
      oddmax = max(oddmax, a[i]);
    } else {
      even++;
      evenmax = max(evenmax, a[i]);
    }
  }
  for (long long i = 0; i < n; i += 1) {
    if (a[i] == oddmax) {
      cntoddmax++;
    }
    if (a[i] == evenmax) {
      cntevenmax++;
    }
  }
  long long res = 0;
  if (odd >= even) {
    res = even;
  } else {
    res = odd;
  }
  cout << res;
}
