#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int co = 0, ce = 0;
  int xi;
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    cin >> xi;
    if (xi & 1)
      ++co;
    else
      ++ce;
  }
  cout << min(co, ce) << endl;
  return 0;
}
