#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e2 + 7;
int g[MAXN][MAXN];
int n;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  vector<int> a(n);
  int ans = 0;
  for (auto &x : a) cin >> x, ans += (x & 1);
  cout << min(ans, n - ans);
  return 0;
}
