#include <bits/stdc++.h>
using namespace std;
map<int, int> ma, mb;
int a[100005];
int b[100005];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    ma[a[i]]++;
    if (a[i] != b[i]) mb[b[i]]++;
  }
  int mn = 1e9;
  for (map<int, int>::iterator it = ma.begin(); it != ma.end(); it++) {
    int x = it->first;
    int y = it->second;
    if (y >= (n + 1) / 2) {
      mn = 0;
      continue;
    }
    int r = (n + 1) / 2 - y;
    if (mb[x] >= r) {
      mn = min(mn, r);
    }
  }
  for (map<int, int>::iterator it = mb.begin(); it != mb.end(); it++) {
    int x = it->first;
    int y = it->second;
    if (y >= (n + 1) / 2) {
      mn = min(mn, (n + 1) / 2);
    }
  }
  if (mn < 1e9)
    cout << mn;
  else
    cout << -1;
  return 0;
}
