#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 * 1 + 5, inf = 1e9 + 5;
int n, ans = inf, flag;
pair<int, bool> add[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    pair<int, int> m;
    cin >> m.first >> m.second;
    add[flag] = {m.first, 0};
    flag++;
    if (m.first != m.second) add[flag] = {m.second, 1}, flag++;
  }
  sort(add, add + flag);
  int cnt = 1, cntb = 0;
  cntb += (add[0].second == 0) ? 0 : 1;
  for (int i = 1; i < flag; i++) {
    if (add[i].first == add[i - 1].first) {
      cnt++;
      if (add[i].second == 1) cntb++;
    } else {
      if (cnt >= (n + 1) / 2)
        ans = min(ans, max((n + 1) / 2 - (cnt - cntb), 0));
      cnt = 1, cntb = 0;
      cntb += (add[i].second == 0) ? 0 : 1;
    }
  }
  if (cnt >= (n + 1) / 2) ans = min(ans, max((n + 1) / 2 - (cnt - cntb), 0));
  if (ans == inf)
    cout << -1;
  else
    cout << ans;
  return 0;
}
