#include <bits/stdc++.h>
using namespace std;
template <class T>
int len(const T& c) {
  return (int)c.size();
}
long long n, t1, t2;
long long ar1[200010];
long long ar2[200010];
long long cnt = 0;
map<long long, long long> m;
int main() {
  cin >> n;
  for (int i(0), _n(n); i < _n; ++i) {
    cin >> t1 >> t2;
    if (t1 == t2) {
      t2 = (1 << 30);
    }
    if (!m[t1]) {
      cnt++;
      m[t1] = cnt;
    }
    t1 = m[t1];
    ar1[t1]++;
    if (t2 == (1 << 30)) continue;
    if (!m[t2]) {
      cnt++;
      m[t2] = cnt;
    }
    t2 = m[t2];
    ar2[t2]++;
  }
  long long cur = (1 << 30);
  for (int i(0), _n(200010); i < _n; ++i) {
    if (ar1[i] + ar2[i] >= (n + 1) / 2) {
      if (cur > ((n + 1) / 2 - ar1[i])) {
        cur = max(0LL, (n + 1) / 2 - ar1[i]);
      }
    }
  }
  if (cur == (1 << 30)) {
    cout << -1;
  } else
    cout << cur;
}
