#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int n;
  cin >> n;
  map<int, pair<long long int, long long int>> m;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (m.find(x) == m.end()) {
      m[x] = make_pair(1, 1);
    } else {
      m[x].first++;
      m[x].second++;
    }
    if (x != y) {
      if (m.find(y) == m.end()) {
        m[y] = make_pair(1, 0);
      } else {
        m[y].first++;
      }
    }
  }
  long long int lim = ceil((double)n / (double)2), ans = LLONG_MAX;
  for (auto &it : m) {
    if (it.second.first >= lim) {
      if (it.second.second < lim) {
        ans = min(ans, lim - it.second.second);
      } else {
        ans = 0;
        break;
      }
    }
  }
  if (ans == LLONG_MAX)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
