#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, mid, x, y;
  cin >> n;
  if (n % 2)
    mid = (n + 1) / 2;
  else
    mid = n / 2;
  map<long long, long long> mop1, mop2;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    vec.push_back(x);
    vec.push_back(y);
    mop1[x]++;
    mop2[y]++;
    if (x == y) mop2[y]--;
  }
  long long maxx = 10e9;
  for (int i = 0; i < vec.size(); i++) {
    long long cur = mop1[vec[i]] + mop2[vec[i]];
    if (cur >= mid) {
      maxx = min(maxx, mid - mop1[vec[i]]);
      if (maxx < 0) maxx = 0;
    }
  }
  if (maxx != 10e9)
    cout << maxx << endl;
  else
    cout << -1 << endl;
  return 0;
}
