#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, a, b;
  map<long long int, long long int> F, B, D;
  cin >> n;
  set<long long int> S;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    F[a]++;
    B[b]++;
    if (a == b) D[a]++;
    S.insert(a);
    S.insert(b);
  }
  long long int ans = 1000000000;
  for (set<long long int>::iterator it = S.begin(); it != S.end(); it++) {
    if (((F[(*it)] + B[(*it)]) - D[(*it)]) >= ceil(n / 2.0))
      ans = min(ans,
                max((long long int)0, (long long int)ceil(n / 2.0) - F[(*it)]));
  }
  if (ans == 1000000000)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
