#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    m[x]++;
  }
  int ans = INF;
  for (auto &[at, l] : m) {
    int cont = 0;
    for (auto &[num, qnt] : m) {
      if (num == at) continue;
      if ((abs(num - at) & 1)) cont += qnt;
    }
    ans = min(ans, cont);
  }
  cout << ans << endl;
  return 0;
}
