#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a;
  cin >> n;
  long long int odd = 0, even = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a;
    if (a % 2 == 0)
      even++;
    else
      odd++;
  }
  cout << min(even, odd);
}
