#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  long long ans = INT_MAX;
  for (int i = 0; i < n; i++) {
    long long cur = 0;
    for (int j = 0; j < n; j++) {
      if (abs(x[i] - x[j]) % 2 == 1) cur++;
    }
    ans = min(cur, ans);
    cur = 0;
    for (int j = 0; j < n; j++) {
      if (abs(x[i] - 1 - x[j]) % 2 == 1) cur++;
    }
    ans = min(cur, ans);
    cur = 0;
    for (int j = 0; j < n; j++) {
      if (abs(x[i] + 1 - x[j]) % 2 == 1) cur++;
    }
    ans = min(cur, ans);
  }
  cout << ans << endl;
  return 0;
}
