#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, roo, zir;
  while (cin >> n) {
    map<int, int> up;
    map<int, int> down;
    for (int i = 0; i < n; i++) {
      cin >> roo >> zir;
      up[roo]++;
      if (zir != roo) down[zir]++;
    }
    int mn = 10000000;
    int half = (n + 1) / 2;
    for (map<int, int>::iterator it = up.begin(); it != up.end(); it++) {
      int card = it->first;
      int cnt = it->second;
      if (cnt >= half) {
        mn = 0;
        break;
      } else {
        if (down.count(card)) {
          int other = down[card];
          if (other + cnt >= half) {
            mn = min(mn, half - cnt);
          }
        }
      }
    }
    for (map<int, int>::iterator it = down.begin(); it != down.end(); it++) {
      int card = it->first;
      int other = it->second;
      if (!up.count(card)) {
        if (other >= half) {
          mn = min(mn, half);
        }
      }
    }
    if (mn == 10000000) mn = -1;
    cout << mn << endl;
  }
  return 0;
}
