#include <bits/stdc++.h>
int dx[8] = {-1, -2, -2, -1, 1, 2, 2, 1};
int dy[8] = {-2, -1, 1, 2, 2, 1, -1, -2};
using namespace std;
vector<vector<int> > g;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int odd = 0, even = 0;
  for (int i = 0; i < n; i++)
    if (arr[i] % 2)
      odd++;
    else
      even++;
  cout << min(odd, even);
}
