#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  map<int, int> mp;
  int cnt[200010][2];
  int idx = 0;
  memset(cnt, 0, sizeof(cnt));
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (mp.find(x) == mp.end()) {
      mp[x] = idx++;
    }
    if (mp.find(y) == mp.end()) {
      mp[y] = idx++;
    }
    if (mp[x] == mp[y]) {
      cnt[mp[x]][0]++;
    } else {
      cnt[mp[x]][0]++;
      cnt[mp[y]][1]++;
    }
  }
  int ans = 1000000000;
  for (int i = 0; i < idx; i++) {
    if (cnt[i][0] + cnt[i][1] >= (n + 1) / 2) {
      int move = 0;
      if (cnt[i][0] < (n + 1) / 2) {
        move = (n + 1) / 2 - cnt[i][0];
      }
      ans = min(ans, move);
    }
  }
  if (ans == 1000000000) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}
