#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  int c = 0, c1 = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      c1++;
    else
      c++;
  }
  cout << min(c, c1);
  return 0;
}
