#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005, INF = 999999999;
struct atype {
  int num, side;
};
atype a[maxn];
int n, k, ans, mid, pppp;
bool cmp(atype a, atype b) {
  if (a.num > b.num)
    return true;
  else
    return false;
}
int js(int k) {
  if (k < 0) return 0;
  return k;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j >= 0; --j) {
      scanf("%d", &k);
      if ((j == 0) && (k == a[pppp].num)) continue;
      a[++pppp].num = k;
      a[pppp].side = j;
    }
  sort(a + 1, a + pppp + 1, cmp);
  ans = INF;
  mid = (1 + n) >> 1;
  for (int i = 1; i <= pppp; ++i)
    if ((i == 1) || (a[i].num != a[i - 1].num)) {
      int l = i, r = l;
      while ((r < pppp) && (a[r + 1].num == a[r].num)) ++r;
      if (r - l + 1 >= mid) {
        int temp = 0;
        for (int j = l; j <= r; ++j) temp += a[j].side;
        ans = min(ans, js(mid - temp));
      }
    }
  if (ans != INF)
    printf("%d\n", ans);
  else
    printf("-1\n");
  return 0;
}
