#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> a, b;
  int n, A, B, BB, AA;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A >> B;
    if (a.find(A) == a.end())
      a[A] = 1;
    else
      a[A]++;
    if (A == B) continue;
    if (b.find(B) == b.end())
      b[B] = 1;
    else
      b[B]++;
  }
  map<int, int>::iterator it;
  int res = 2000000000, need = n / 2 + n % 2;
  for (it = a.begin(); it != a.end(); it++) {
    if (b.find((*it).first) == b.end())
      BB = 0;
    else
      BB = b[(*it).first];
    AA = (*it).second;
    if (AA + BB >= need) {
      res = min(res, max(0, need - AA));
    }
  }
  if (res == 2000000000)
    for (it = b.begin(); it != b.end(); it++) {
      if (a.find((*it).first) == a.end()) {
        if ((*it).second >= need) {
          res = need;
          break;
        }
      }
    }
  if (res == 2000000000)
    cout << "-1" << endl;
  else
    cout << res << endl;
  return 0;
}
