#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int x, n;
int main() {
  cin >> n;
  int c = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x & 1) c++;
  }
  int ans = min(c, n - c);
  cout << ans;
}
