#include <bits/stdc++.h>
using namespace std;
const int MAXM = 1e5 + 5;
const int MAXN = 1e6 + 5;
const int INF = 1e7 + 9;
const int MOD = 1e9 + 9;
const int MX = 1e9;
int main() {
  int n;
  cin >> n;
  int sum1 = 0, sum = 0;
  while (n--) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      sum1++;
    else
      sum++;
  }
  cout << min(sum, sum1);
}
