#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
typedef struct card {
  int up;
  int down;
} card;
map<int, card> M;
map<int, card>::iterator it;
int main() {
  int n, half;
  int c1, c2;
  card c;
  scanf("%d", &n);
  half = ceil(n / 2.0);
  for (int(i) = 0; (i) < (n); ++(i)) {
    scanf("%d %d", &c1, &c2);
    it = M.find(c1);
    if (it == M.end()) {
      c.up = 1;
      c.down = 0;
      M.insert(make_pair(c1, c));
    } else {
      it->second.up++;
    }
    if (c1 != c2) {
      it = M.find(c2);
      if (it == M.end()) {
        c.up = 0;
        c.down = 1;
        M.insert(make_pair(c2, c));
      } else {
        it->second.down++;
      }
    }
  }
  int min_moves = 1000000000;
  int tmp;
  for (it = M.begin(); it != M.end(); it++) {
    c = it->second;
    tmp = max(half - c.up, 0);
    if (c.down >= tmp) {
      (min_moves) = min((min_moves), (tmp));
      ;
    }
  }
  if (min_moves == 1000000000)
    printf("-1\n");
  else
    printf("%d\n", min_moves);
  return 0;
}
