#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int j = 0, n, m, a, b, mid, upper, lower, mn = -1;
  cin >> n;
  if (n % 2 == 0)
    mid = n / 2;
  else
    mid = (n + 1) / 2;
  m = n * 2;
  long long int ar1[n], ar2[m];
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    ar1[i] = a;
    if (a != b) {
      ar2[j] = a;
      j++;
      ar2[j] = b;
      j++;
    } else {
      ar2[j] = a;
      j++;
    }
  }
  sort(ar1, ar1 + n);
  sort(ar2, ar2 + j);
  for (int i = 0; i < j; i++) {
    upper = upper_bound(ar2, ar2 + j, ar2[i]) - ar2;
    lower = lower_bound(ar2, ar2 + j, ar2[i]) - ar2;
    a = upper - lower;
    if (a >= mid) {
      upper = upper_bound(ar1, ar1 + n, ar2[i]) - ar1;
      lower = lower_bound(ar1, ar1 + n, ar2[i]) - ar1;
      a = upper - lower;
      b = mid - a;
      if (b < 0) b = 0;
      if (mn == -1)
        mn = b;
      else {
        if (b < mn) mn = b;
      }
    }
  }
  cout << mn << endl;
  return 0;
}
