#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, ans = INT_MAX;
  cin >> n;
  int hl = (n + 1) / 2;
  map<int, int> mp1, mp2;
  set<int> s;
  for (i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == b) {
      mp1[a]++;
    } else {
      mp1[a]++;
      mp2[b]++;
    }
    s.insert(a);
    s.insert(b);
  }
  int len = s.size();
  set<int>::iterator it;
  for (it = s.begin(); it != s.end(); it++) {
    int d = *it;
    if (mp1[d] >= hl) {
      ans = 0;
    } else if (mp1[d] + mp2[d] >= hl) {
      int need = max(0, hl - mp1[d]);
      ans = min(ans, need);
    }
  }
  if (ans == INT_MAX) {
    cout << -1;
  } else {
    cout << ans;
  }
}
