#include <bits/stdc++.h>
using namespace std;
string tobin(int x, int len) {
  string c;
  while (x > 0) {
    c.push_back(x % 2 + '0');
    x >>= 1;
  }
  while (int((c).size()) < len) c.push_back('0');
  reverse((c).begin(), (c).end());
  return c;
}
const int MXN = 100000;
int n, aa[MXN + 5], bb[MXN + 5];
map<int, int> fr, ba;
int ans, half, tmpa, tmpi;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &aa[i], &bb[i]);
    fr[aa[i]]++;
    if (aa[i] != bb[i]) ba[bb[i]]++;
  }
  half = (int)ceil(n / 2.0);
  ans = 1000000000;
  for (typeof((fr).end()) it = (fr).begin(); it != (fr).end(); ++it) {
    tmpa = it->second;
    tmpi = (ba.count(it->first) ? ba[it->first] : 0);
    if (tmpa + tmpi >= half) ans = min(ans, max(0, half - tmpa));
  }
  for (typeof((ba).end()) it = (ba).begin(); it != (ba).end(); ++it) {
    tmpa = it->second;
    tmpi = (fr.count(it->first) ? fr[it->first] : 0);
    if (tmpa + tmpi >= half) ans = min(ans, max(0, half - tmpi));
  }
  printf("%d\n", ans == 1000000000 ? -1 : ans);
  return 0;
}
