#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
  map<long long, pair<long long, long long> > m;
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i = i + 1) {
    long long x, y;
    cin >> x >> y;
    if (x == y) {
      if (m.find(x) == m.end())
        m[x] = make_pair(1, 0);
      else
        m[x].first++;
    } else {
      if (m.find(x) == m.end())
        m[x] = make_pair(1, 0);
      else
        m[x].first++;
      if (m.find(y) == m.end())
        m[y] = make_pair(0, 1);
      else
        m[y].second++;
    }
  }
  long long mn = 1e5;
  for (auto it = m.begin(); it != m.end(); it++) {
    if ((it->second).first + (it->second).second >= (n + 1) / 2) {
      mn = min(mn, (n + 1) / 2 - (it->second).first);
    }
    if ((it->second).first >= (n + 1) / 2) {
      cout << 0;
      return 0;
    }
  }
  if (mn < (long long)1e5)
    cout << mn;
  else
    cout << -1;
}
