#include <bits/stdc++.h>
using namespace std;
int n;
struct card {
  int s1, s2;
} c[100001] = {0};
map<int, pair<int, int> > m;
int main() {
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d%d", &c[i].s1, &c[i].s2);
    if (m.find(c[i].s1) == m.end()) {
      pair<int, int> p;
      p.first = 1;
      p.second = 0;
      m[c[i].s1] = p;
    } else {
      pair<int, int> p = m[c[i].s1];
      p.first++;
      m[c[i].s1] = p;
    }
    if (c[i].s1 != c[i].s2)
      if (m.find(c[i].s2) == m.end()) {
        pair<int, int> p;
        p.first = 0;
        p.second = 1;
        m[c[i].s2] = p;
      } else {
        pair<int, int> p = m[c[i].s2];
        p.second++;
        m[c[i].s2] = p;
      }
  }
  int need = (n + 1) / 2;
  int min_d = 1e9;
  map<int, pair<int, int> >::iterator it;
  for (it = m.begin(); it != m.end(); it++) {
    pair<int, int> p = (*it).second;
    int td = 1e9;
    if (p.first + p.second >= need) {
      td = need - p.first;
      if (td < 0) td = 0;
    }
    if (td < min_d) min_d = td;
  }
  if (min_d == 1e9)
    printf("-1");
  else
    printf("%d", min_d);
  return 0;
}
