#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000 + 10;
int N, tot;
int a[MAX_N], b[MAX_N];
struct INFO {
  int col, opt;
  int operator<(const INFO &that) const {
    return col < that.col || col == that.col && opt < that.opt;
  }
  int operator==(const INFO &that) const { return col == that.col; }
} data[MAX_N * 2];
void inputData() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) {
    scanf("%d%d", &a[i], &b[i]);
    data[tot].col = a[i];
    data[tot++].opt = 0;
    if (b[i] != a[i]) {
      data[tot].col = b[i];
      data[tot++].opt = 1;
    }
  }
}
void calcAns() {
  sort(data, data + tot);
  int l, r, ret = N + 1;
  int cnt[2], x = (N + 1) >> 1;
  for (l = 0; l < tot; l = r + 1) {
    cnt[0] = cnt[1] = 0;
    cnt[data[l].opt]++;
    for (r = l; r + 1 < tot && data[r + 1] == data[l]; ++r) {
      cnt[data[r + 1].opt]++;
    }
    if (cnt[0] + cnt[1] >= x) {
      if (cnt[0] >= x)
        ret = 0;
      else
        ret = min(ret, x - cnt[0]);
    }
  }
  if (ret == N + 1)
    puts("-1");
  else
    printf("%d\n", ret);
}
void solve() {
  inputData();
  calcAns();
}
int main() {
  solve();
  return 0;
}
