#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long x[n];
  int i;
  int ect = 0;
  int oct = 0;
  for (i = 0; i < n; i++) {
    cin >> x[i];
    if (x[i] % 2 == 0)
      ect++;
    else
      oct++;
  }
  int r = min(ect, oct);
  cout << r;
}
