#include <bits/stdc++.h>
using namespace std;
const long long M = 998244353;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long odd = 0, even = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] % 2)
      odd++;
    else
      even++;
  }
  cout << min(even, odd) << "\n";
  return 0;
}
