#include <bits/stdc++.h>
using namespace std;
long long int tmod(long long int x, long long int m) { return (x % m + m) % m; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  map<int, int> mpf, mpb;
  for (int i = 1; i < n + 1; i++) {
    int x, y;
    cin >> x >> y;
    if (mpf.find(x) == mpf.end())
      mpf.insert({x, 1});
    else
      mpf[x]++;
    if (mpb.find(x) == mpb.end()) mpb.insert({x, 0});
    if (x != y) {
      x = y;
      if (mpb.find(x) == mpb.end())
        mpb.insert({x, 1});
      else
        mpb[x]++;
      if (mpf.find(x) == mpf.end()) mpf.insert({x, 0});
    }
  }
  int ans = 999999999;
  map<int, int>::iterator fitr = mpf.begin(), bitr = mpb.begin();
  while (fitr != mpf.end()) {
    if (2 * fitr->second >= n) {
      ans = 0;
    } else if (2 * (fitr->second + bitr->second) >= n) {
      ans = min(ans, (n + 1) / 2 - fitr->second);
    }
    fitr++, bitr++;
  }
  if (ans == 999999999)
    cout << -1;
  else
    cout << ans;
  return 0;
}
