#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int q[N], tt;
map<int, int> cnt1, cnt2;
int main() {
  int n;
  scanf("%d", &n);
  int s = n + 1 >> 1;
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    cnt1[x]++;
    if (x != y) cnt1[y]++;
    cnt2[x]++;
    q[++tt] = x;
    q[++tt] = y;
  }
  int res = 0x7f7f7f7f;
  for (int i = 1; i <= tt; i++) {
    if (cnt1[q[i]] >= s && cnt2[q[i]] >= s) return puts("0"), 0;
    if (cnt1[q[i]] >= s) res = min(res, s - cnt2[q[i]]);
  }
  if (res == 0x7f7f7f7f)
    puts("-1");
  else
    printf("%d\n", res);
  return 0;
}
