#include <bits/stdc++.h>
using namespace std;
int n;
int x, y;
int req;
int mind = 987654321;
map<int, int> mst;
struct boja {
  int count_up;
  int count_down;
  int mov_need;
};
int idd = 1;
boja B[200000];
int main() {
  scanf("%d", &n);
  if (n % 2 == 0)
    req = n / 2;
  else
    req = n / 2 + 1;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    if (mst.find(x) == mst.end()) {
      mst[x] = idd;
      idd++;
    }
    if (mst.find(y) == mst.end()) {
      mst[y] = idd;
      idd++;
    }
    B[mst[x]].count_up++;
    if (x != y) B[mst[y]].count_down++;
  }
  map<int, int>::iterator it;
  for (int i = 0; i < idd; i++) {
    if (B[i].count_up + B[i].count_down >= req) {
      int req1 = req;
      req1 -= B[i].count_up;
      if (req1 < 0) req1 = 0;
      if (req1 < mind) mind = req1;
    }
  }
  if (mind == 987654321) {
    printf("-1\n");
  } else
    printf("%d\n", mind);
  return 0;
}
