#include <bits/stdc++.h>
using namespace std;
int n, cnt;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a % 2) cnt++;
  }
  cout << min(cnt, n - cnt) << endl;
}
