#include <bits/stdc++.h>
using namespace std;
map<int, int> frontc;
map<int, int> backc;
int main() {
  int n, ans, a, b, x, i, x1;
  cin >> n;
  ans = n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    if (a != b) backc[b]++;
    frontc[a]++;
  }
  map<int, int>::iterator it;
  for (it = frontc.begin(); it != frontc.end(); it++) {
    x = it->first;
    a = frontc[x];
    b = backc[x];
    if (a >= (n + 1) / 2) {
      cout << 0 << endl;
      return 0;
    }
    if (a + b >= (n + 1) / 2)
      if ((n + 1) / 2 - a < ans) ans = (n + 1) / 2 - a;
  }
  if (ans != n) {
    cout << ans << endl;
    return 0;
  }
  for (it = backc.begin(); it != backc.end(); it++) {
    x = it->first;
    b = backc[x];
    if (b >= (n + 1) / 2) {
      cout << (n + 1) / 2 << endl;
      return 0;
    }
  }
  if (ans == n) {
    cout << -1 << endl;
    return 0;
  }
  cout << ans << endl;
  return 0;
}
