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