#include <bits/stdc++.h>
using namespace std;
int a, s, d, f, g, h, j, k, l, i, n, m;
map<int, int> p, q;
set<int> w;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> s;
    p[a]++;
    if (a != s) q[s]++;
    w.insert(a);
    w.insert(s);
  }
  k = 100000000;
  for (set<int>::iterator it = w.begin(); it != w.end(); it++) {
    if (p[*it] + q[*it] >= (n + 1) / 2) k = min(k, (n + 1) / 2 - p[*it]);
  }
  if (k < 0) k = 0;
  if (k == 100000000)
    cout << -1;
  else
    cout << k;
}
