#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, ce = 0, co = 0;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 == 0)
      a[i] = 0, ce++;
    else
      a[i] = 1, co++;
  }
  cout << min(ce, co);
  return 0;
}
