#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int main() {
  int n, cnt[2] = {0, 0}, tem;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &tem);
    cnt[tem % 2]++;
  }
  printf("%d\n", min(cnt[0], cnt[1]));
  return 0;
}
