#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, eve = 0, odd = 0;
  cin >> n;
  long long int num;
  for (long long int i = 0; i < n; i++) {
    cin >> num;
    if (num % 2 == 0)
      eve++;
    else
      odd++;
  }
  cout << min(eve, odd) << endl;
  return 0;
}
