#include <bits/stdc++.h>
using namespace std;
int main() {
  for (int n; cin >> n && n;) {
    vector<int> fs(n), bs(n);
    for (int i = int(0); i < int(n); i++) cin >> fs[i] >> bs[i];
    map<int, int> m1, m2;
    for (int i = int(0); i < int(n); i++) {
      m1[fs[i]]++;
      if (fs[i] != bs[i]) m1[bs[i]]++;
      m2[fs[i]]++;
    }
    int res = -1;
    for (pair<int, int> p : m1) {
      if (p.second >= (n + 1) / 2) {
        int tmp = max((n + 1) / 2 - m2[p.first], 0);
        if (res == -1 || res > tmp) res = tmp;
      }
    }
    cout << res << endl;
  }
  return 0;
}
