#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cout.precision(12);
  cin.tie(0);
  int n;
  cin >> n;
  map<int, pair<int, int> > vals;
  for (int i = 0; i < n; ++i) {
    int f, b;
    cin >> f >> b;
    vals[f].first++;
    if (f != b) {
      vals[b].second++;
    }
  }
  int best = n + 1;
  for (auto& i : vals) {
    if (i.second.first + i.second.second >= (n + 1) / 2) {
      best = min(best, max(0, (n + 1) / 2 - i.second.first));
    }
  }
  if (best > n) {
    best = -1;
  }
  cout << best << "\n";
  return 0;
}
