#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double pi = 2 * acos(0.0);
const int kmax = 200000;
const int nmax = 200000;
const long long mod = 1000000007;
const int mmax = 3800000;
const int hash_base = 119;
const double eps = 1e-9;
template <class T>
T BitCount(T mask) {
  return mask ? BitCount(mask & (mask - 1)) + 1 : 0;
};
template <class T>
int BIT(T mask, int pos) {
  return (mask >> pos) & 1;
};
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
};
template <class T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
};
template <class T>
T Max(T a, T b) {
  return (a > b) ? a : b;
};
template <class T>
T Min(T a, T b) {
  return (a < b) ? a : b;
};
template <class T>
T Sqr(T a) {
  return a * a;
};
template <class T>
T Abs(T a) {
  return (a < 0) ? -a : a;
};
template <class T>
bool Prime(T a) {
  if (a <= 1) return false;
  for (T i = 2; i * i <= a; i++)
    if (a % i == 0) return false;
  return true;
};
template <class T>
T BinPow(T a, T b) {
  T ans = 1;
  while (b) {
    if (b & 1)
      ans = (ans * a), --b;
    else
      a = (a * a), b >>= 1;
  };
  return ans;
};
template <class T>
T BinPowMod(T a, T b, T m) {
  T ans = 1;
  while (b) {
    if (b & 1)
      ans = (ans * a) % m, --b;
    else
      a = (a * a) % m, b >>= 1;
  };
  return ans;
};
map<int, pair<int, int>> status;
int n, a, b, ans = 2e9;
int main() {
  scanf("%d", &n);
  for (int(i) = 1; i <= (n); (i)++) {
    scanf("%d%d", &a, &b);
    status[a].first++;
    if (a != b) status[b].second++;
  };
  for (map<int, pair<int, int>>::iterator it = status.begin();
       it != status.end(); it++) {
    int open = it->second.first;
    int close = it->second.second;
    open = (n + 1) / 2 - open;
    if (open <= 0)
      ans = 0;
    else if (close >= open)
      ans = Min(ans, open);
  };
  if (ans == 2e9) ans = -1;
  cout << ans << endl;
  return 0;
};
