#include <bits/stdc++.h>
using namespace std;
const int XMAX = 1000000000 + 7;
const int XMIN = -1;
int main() {
  int n;
  cin >> n;
  int mid = ceil(n / 2.0);
  map<int, int> m;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) {
    int x, y;
    cin >> x >> y;
    ++m[x];
    if (x != y) ++m[y];
    a[i] = x;
  }
  map<int, int> cnt;
  for (int i = 0; i < (n); ++i) ++cnt[a[i]];
  for (map<int, int>::iterator it = cnt.begin(); it != cnt.end(); ++it)
    if (it->second >= mid) {
      cout << 0 << endl;
      exit(0);
    }
  vector<int> v;
  v.reserve(2 * n);
  for (map<int, int>::iterator it = m.begin(); it != m.end(); ++it)
    if (it->second >= mid) v.push_back(mid - cnt[it->first]);
  sort(v.begin(), v.end());
  if (v.empty()) {
    cout << -1 << endl;
  } else {
    cout << v[0] << endl;
  }
  return 0;
}
