#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0;
  long long temp = 10000000000000;
  cin >> n;
  int a[n + 1];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int x = abs(a[i] - a[j]);
      if (x % 2 == 1) c++;
    }
    if (c <= temp) {
      temp = c;
      c = 0;
    }
  }
  cout << temp << endl;
}
