#include <bits/stdc++.h>
using namespace std;
long long a[300010][2] = {0};
long long ans[300010][2] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  map<long long, long long> ref;
  long long n;
  cin >> n;
  long long m = (n + 1) / 2;
  vector<long long> b;
  for (long long i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    b.push_back(a[i][0]);
    b.push_back(a[i][1]);
  }
  sort(b.rbegin(), b.rend());
  long long prev = 0;
  long long count = 0;
  for (long long i = 0; i < b.size(); i++) {
    if (b[i] != prev) {
      ref[b[i]] = count++;
      prev = b[i];
    }
  }
  for (long long i = 0; i < n; i++) {
    a[i][0] = ref[a[i][0]];
    ans[a[i][0]][0]++;
    a[i][1] = ref[a[i][1]];
    if (a[i][1] != a[i][0]) ans[a[i][1]][1]++;
  }
  long long ret = 1000000000;
  for (long long i = 0; i <= count; i++) {
    if ((ans[i][0] + ans[i][1]) >= m) {
      if (ans[i][0] <= m)
        ret = min(ret, m - ans[i][0]);
      else
        ret = 0;
    }
  }
  if (ret == 1000000000)
    cout << "-1" << endl;
  else
    cout << ret << endl;
  return 0;
}
