#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, y;
  cin >> n;
  long long ans = LLONG_MAX, tmp;
  map<long long, long long> mp, f, b;
  set<long long> s;
  set<long long>::iterator it;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    s.insert(x);
    s.insert(y);
    mp.insert(make_pair(x, y));
    if (x == y)
      f[x]++;
    else {
      f[x]++;
      b[y]++;
    }
  }
  for (it = s.begin(); it != s.end(); ++it) {
    int cmp;
    if (n & 1)
      cmp = (n / 2) + 1;
    else
      cmp = n / 2;
    tmp = f[*it] + b[*it];
    if (f[*it] >= cmp) {
      ans = 0;
      break;
    } else if (tmp >= cmp) {
      tmp = f[*it];
      ans = min(ans, cmp - tmp);
    }
  }
  if (ans == LLONG_MAX)
    cout << -1;
  else
    cout << ans;
}
