#include <bits/stdc++.h>
using namespace std;
int const N = 100;
long long min(long long x, long long y) {
  if (x < y)
    return x;
  else
    return y;
}
long long max(long long x, long long y) {
  if (x > y)
    return x;
  else
    return y;
}
int main() {
  long long i, j;
  long long n;
  cin >> n;
  vector<long long> v(n);
  long long sum = 0;
  for (i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  sort(v.begin(), v.end());
  long long x = sum / n;
  long long y = x + 1;
  long long z = max(1, x - 1);
  long long a = 0, b = 0, c = 0;
  for (i = 0; i < n; i++) {
    a += (abs(x - v[i]) % 2 == 1);
    b += (abs(y - v[i]) % 2 == 1);
    c += (abs(z - v[i]) % 2 == 1);
  }
  cout << min(a, min(b, c)) << endl;
}
