#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  for (; a %= b; swap(a, b))
    ;
  return a;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int even = 0, odd = 0;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (temp % 2 == 0)
      even++;
    else
      odd++;
  }
  cout << min(even, odd);
  return 0;
}
