#include <bits/stdc++.h>
using namespace std;
int n, x[100002], y[100002], z[2 * 100002], i, j, l = 0, ans, minv = 100002;
vector<int> v;
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &x[i], &y[i]);
    z[l++] = x[i];
    if (x[i] != y[i]) z[l++] = y[i];
  }
  sort(z, z + l);
  for (i = 0; i < l;) {
    j = i;
    while (z[i] == z[j] && i < l) i++;
    if (i - j >= (n + 1) / 2) {
      v.push_back(z[j]);
    }
  }
  if (v.empty()) {
    printf("-1\n");
    return 0;
  }
  for (i = 0; i < int((v).size()); i++) {
    ans = (n + 1) / 2;
    for (j = 0; j < n; j++) {
      if (x[j] == v[i]) ans--;
    }
    minv = min(ans, minv);
  }
  printf("%d\n", max(0, minv));
  return 0;
}
