#include <bits/stdc++.h>
using namespace std;
struct card {
  int u, d;
};
card a[200000];
int b[300000], d[3000000], up[300000], down[300000];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &a[i].u, &a[i].d);
    b[2 * i] = a[i].u;
    b[2 * i + 1] = a[i].d;
  }
  sort(&b[0], &b[2 * n]);
  d[0] = b[0];
  int k = 1;
  for (int i = 1; i < 2 * n; ++i) {
    if (b[i] != b[i - 1]) {
      d[k] = b[i];
      k++;
    }
  }
  int L, R, M;
  for (int i = 0; i < n; ++i) {
    L = 0;
    R = k;
    while (L + 1 < R) {
      M = (L + R) / 2;
      if (d[M] > a[i].u)
        R = M;
      else
        L = M;
    }
    up[L]++;
  }
  for (int i = 0; i < n; ++i) {
    L = 0;
    R = k;
    while (L + 1 < R) {
      M = (L + R) / 2;
      if (d[M] > a[i].d)
        R = M;
      else
        L = M;
    }
    if (a[i].d != a[i].u) down[L]++;
  }
  int min = 0, now = -1;
  for (int i = 0; i < k; ++i) {
    if (up[i] >= (n + 1) / 2) {
      min = 0;
      now = i;
      break;
    }
    if (up[i] + down[i] >= (n + 1) / 2) {
      if ((now == -1) || ((n + 1) / 2 - up[i] < min)) {
        now = i;
        min = (n + 1) / 2 - up[i];
      }
    }
  }
  if (now == -1)
    printf("-1");
  else
    printf("%d", min);
}
