#include <bits/stdc++.h>
using namespace std;
int dobs = 0;
int arr[100000];
int main() {
  int n;
  int cost = 0;
  vector<int> v;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  int index = -1;
  int maxx = 0;
  int in = -1;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (arr[i] == arr[j]) {
        if (index == -1) index = i;
        dobs++;
      }
    }
    in = index;
    index = -1;
    if (dobs > maxx) maxx = dobs;
    dobs = 0;
  }
  if (in != -1) {
    for (int i = 0; i < n; i++) {
      if (i != in && arr[i] != arr[in]) {
        if (abs(arr[i] - arr[in]) % 2 == 1) {
          cost++;
        }
      }
    }
  } else {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i != j) {
          if (abs(arr[i] - arr[j]) % 2 == 1) {
            cost++;
          }
        }
      }
      v.push_back(cost);
      cost = 0;
    }
  }
  sort(v.begin(), v.end());
  cout << v[0] << endl;
  return 0;
}
