#include <bits/stdc++.h>
using namespace std;
int n;
void read() { cin >> n; }
void solve() {
  int sol = 0, sol2 = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      ++sol;
    else
      ++sol2;
  }
  cout << min(sol, sol2) << "\n";
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  while (t) {
    --t;
    read();
    solve();
  }
  return 0;
}
