#include <bits/stdc++.h>
using namespace std;
const int _N = 400010;
int n, a[_N], b[_N], idxN, idx[_N], sum[_N], cnt[_N];
void delRep(int a[], int &aN) {
  int bN = 0;
  for (int i = 0; i < aN; i++)
    if ((i == 0) || (a[i] != a[i - 1])) a[bN++] = a[i];
  aN = bN;
}
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(2);
  cin >> n;
  idxN = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    idx[idxN++] = a[i];
    idx[idxN++] = b[i];
  }
  sort(idx, idx + idxN);
  delRep(idx, idxN);
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(idx, idx + idxN, a[i]) - idx;
    b[i] = lower_bound(idx, idx + idxN, b[i]) - idx;
  }
  memset(sum, 0, sizeof(sum));
  memset(cnt, 0, sizeof(cnt));
  int ans = _N;
  for (int i = 0; i < n; i++) {
    sum[a[i]]++;
    cnt[a[i]]++;
    if (sum[a[i]] >= (n + 1) / 2) {
      ans = min(ans, (n + 1) / 2 - cnt[a[i]]);
    }
    if (b[i] != a[i]) {
      sum[b[i]]++;
      if (sum[b[i]] >= (n + 1) / 2) {
        ans = min(ans, (n + 1) / 2 - cnt[b[i]]);
      }
    }
  }
  if (ans < 0) ans = 0;
  if (ans == _N) ans = -1;
  cout << ans << endl;
  return 0;
}
