#include <bits/stdc++.h>
using namespace std;
const int i32INF = 1000 * 1000 * 1000;
const long long i64INF = 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v(n);
  for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    m[v[i].first]++;
    if (v[i].first != v[i].second) m[v[i].second]++;
  }
  vector<int> cs;
  for (map<int, int>::iterator it = m.begin(); it != m.end(); it++)
    if (it->second >= (n + 1) / 2) cs.push_back(it->first);
  map<int, int> left, right;
  for (int i = 0; i < n; i++) {
    left[v[i].first]++;
    if (v[i].first != v[i].second) right[v[i].second]++;
  }
  int best = i32INF;
  for (int i = 0; i < cs.size(); i++) {
    int color = cs[i];
    int cm = (n + 1) / 2 - left[color];
    best = min(best, cm);
  }
  best = max(best, 0);
  if (best == i32INF)
    cout << -1 << endl;
  else
    cout << best << endl;
  return 0;
}
