#include <bits/stdc++.h>
using namespace std;
const int64_t M = 1e5 + 5;
int64_t n, f[M], b[M];
map<int64_t, int64_t> c, fr;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int64_t i = 1; i <= n; i++) {
    cin >> f[i] >> b[i];
    c[f[i]]++;
    fr[f[i]]++;
    if (b[i] != f[i]) c[b[i]]++;
  }
  int64_t pos = 0, ans = 1e9;
  for (auto i : c) {
    if (i.second >= (n + 1) / 2) {
      pos = 1;
      int64_t reqd = (n + 1) / 2 - fr[i.first];
      int64_t curr = reqd <= 0 ? 0 : reqd;
      ans = min(ans, curr);
    }
  }
  if (!pos) return cout << -1, 0;
  cout << (ans == 1e9 ? 0 : ans);
  return 0;
}
