#include <bits/stdc++.h>
using namespace std;
map<int, int> f, s;
int main() {
  int n;
  cin >> n;
  int m = (n + 1) / 2;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == b)
      f[a]++;
    else {
      f[a]++;
      s[b]++;
    }
  }
  int mn = 1e9;
  for (auto it : f) {
    int val = it.first;
    int c = it.second;
    int dif = m - c;
    if (dif <= 0)
      mn = min(0, mn);
    else {
      c = s[val];
      if (c >= dif) mn = min(dif, mn);
    }
  }
  for (auto it : s) {
    int c = it.second;
    if (c >= m) {
      mn = min(m, mn);
      break;
    }
  }
  if (mn == 1e9)
    cout << "-1" << endl;
  else
    cout << mn << endl;
  return 0;
}
