#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    int oo;
    cin >> oo;
    (oo % 2) ? a++ : b++;
  }
  cout << min(a, b) << "\n";
}
