#include <bits/stdc++.h>
using namespace std;
const int CMax = 200002;
const int CVMax = 40;
const int CInf = 2000000001;
const long long CMod = 1000000007;
int n, k, A[CMax];
long long gcd(long long a, long long b) {
  if (b != 0)
    return gcd(b, a % b);
  else
    return a;
}
int main() {
  int o = 0, e = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
    if (A[i] % 2 == 0)
      e++;
    else
      o++;
  }
  printf("%d\n", min(o, e));
  return 0;
}
