#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, f, b, c = N, m;
set<int> dis;
map<int, int> frnt, bak;
int main() {
  cin >> n;
  m = (n + 1) >> 1;
  for (int i = 0; i < n; i++) {
    cin >> f >> b;
    dis.insert(f);
    dis.insert(b);
    frnt[f]++;
    if (f != b) bak[b]++;
  }
  for (int i : dis) {
    if (frnt[i] + bak[i] >= m) c = min(c, max(m - frnt[i], 0));
  }
  if (c == N)
    cout << -1;
  else
    cout << c;
  return 0;
}
