#include <bits/stdc++.h>
using namespace std;
long long n, a[100001], b[100001];
map<long long, long long> cntup;
map<long long, long long> cntdown;
long long ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  long long x = (n + 1) / 2;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i] >> b[i];
    cntup[a[i]]++;
    if (a[i] != b[i]) cntdown[b[i]]++;
  }
  bool ok = false;
  ans = (long long)(1e18);
  for (long long i = 1; i <= n; ++i) {
    if (cntup[a[i]] + cntdown[a[i]] >= x) {
      long long curans = x - cntup[a[i]];
      if (curans < 0) curans = 0;
      ans = min(ans, curans);
      ok = 1;
    }
    if (cntup[b[i]] + cntdown[b[i]] >= x) {
      long long curans = x - cntup[b[i]];
      if (curans < 0) curans = 0;
      ans = min(ans, curans);
      ok = 1;
    }
  }
  if (!ok) {
    cout << -1;
    return 0;
  }
  cout << (ans == (long long)(1e18) ? -1 : ans);
}
