#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)(10e9) + 1;
int main() {
  ios_base::sync_with_stdio(false);
  int n, i, j, x;
  cin >> n;
  int k = 0;
  for (int i = 0; i < (int)n; i++) {
    cin >> x;
    k += x & 1;
  }
  cout << min(k, n - k) << endl;
}
