#include <bits/stdc++.h>
using namespace std;
bool p[100001];
vector<int> v;
void sieve() {
  for (int i = 4; i <= 1000; i += 2) p[i] = 1;
  for (int i = 3; i <= sqrt(1000); i += 2) {
    if (p[i] == 0) {
      for (int j = i * i; j <= 1000; j += i) p[j] = 1;
    }
  }
  for (int i = 2; i <= 1000; i++) {
    if (p[i] == 0) {
      v.push_back(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t, n, m, odd = 0, even = 0, b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b;
    if (b % 2)
      odd++;
    else
      even++;
  }
  cout << min(odd, even);
  return 0;
}
