#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  map<int, int> front;
  map<int, int> total;
  vector<pair<int, int> > P;
  int target = N / 2 + ((N % 2) ? 1 : 0);
  for (int i = (0); i < (N); ++i) {
    int a, b;
    cin >> a >> b;
    P.push_back(make_pair(a, b));
    if (a == b) {
      total[a]++;
      front[a]++;
    } else {
      total[a]++;
      total[b]++;
      front[a]++;
    }
  }
  vector<int> possible;
  map<int, int>::iterator itt = total.begin();
  int minn = 2000000000;
  for (; itt != total.end(); ++itt) {
    if (itt->second >= target) {
      minn = min(minn, target - front[itt->first]);
    }
  }
  if (minn == 2000000000) {
    cout << -1 << endl;
    return 0;
  }
  if (minn < 0) minn = 0;
  cout << minn << endl;
}
