#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8, pi = acos(-1.0);
int cl(double z) { return ceil(z - eps); }
int flr(double z) { return floor(z + eps); }
long long cll(double z) { return ceil(z - eps); }
long long flrl(double z) { return floor(z + eps); }
int dblcmp(double d) { return (d < -eps) ? -1 : (d > eps); }
const int inf = 999999999;
const long long infl = 999999999999999999LL;
template <class T>
inline void checkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline bool fcheckmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T>
inline bool fcheckmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T>
inline double dist(T a, T b) {
  return sqrt(a * 1.0 * a + b * 1.0 * b);
}
inline int pinput() {
  int S = 0, c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    S = S * 10 + c - 48;
    c = getchar();
  }
  return S;
}
char buf[1000005];
const int maxn = 1000005;
int a[maxn], b[maxn];
map<int, int> M;
void solve() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) {
    scanf("%d%d", &a[i], &b[i]);
    if (a[i] == b[i])
      M[a[i]]++;
    else {
      M[a[i]]++;
      M[b[i]]++;
    }
  }
  int ans = inf;
  int need = (n + 1) / 2;
  for (map<int, int>::iterator it = M.begin(); it != M.end(); it++) {
    if (it->second * 2 < n) continue;
    int f = it->first;
    int tmp = 0;
    for (int i = (1); i <= (n); i++) {
      if (a[i] == f) tmp++;
    }
    int res;
    if (tmp >= need)
      res = 0;
    else
      res = need - tmp;
    checkmin(ans, res);
  }
  if (ans >= inf)
    puts("-1");
  else
    cout << ans << endl;
}
int main() {
  do {
    solve();
  } while (0);
}
