#include <bits/stdc++.h>
using namespace std;
int check(string str) {
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == '.')
      continue;
    else
      return 0;
  }
  return 1;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int num;
  cin >> num;
  long long int temp;
  long long int odd = 0, even = 0;
  for (int i = 0; i < num; i++) {
    cin >> temp;
    if (temp % 2 == 0)
      even++;
    else
      odd++;
  }
  cout << min(even, odd) << "\n";
}
