#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
template <typename T>
inline T Abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T sqr(T a) {
  return a * a;
}
template <typename T>
inline void relaxMin(T &a, T b) {
  if (b < a) a = b;
}
template <typename T>
inline void relaxMax(T &a, T b) {
  if (b > a) a = b;
}
const int INF = (int)1E9;
const long double EPS = 1E-10;
const long double PI = 3.1415926535897932384626433832795;
int n;
int a[100500], b[100500];
map<int, int> cnt;
map<int, int> cnta;
map<int, int> cntb;
vector<int> cc;
void solve() {
  cin >> n;
  for (int i(0), _bb(n); i < _bb; ++i) {
    cin >> a[i] >> b[i];
  }
  for (int i(0), _bb(n); i < _bb; ++i) {
    cnt[a[i]]++;
    cnta[a[i]]++;
    if (a[i] != b[i]) {
      cnt[b[i]]++;
    }
    cc.push_back(a[i]);
    cc.push_back(b[i]);
  }
  sort(cc.begin(), cc.end());
  cc.resize(unique(cc.begin(), cc.end()) - cc.begin());
  int need = (n + 1) / 2;
  int ans = INF;
  for (int p = (cc.size()) - 1; p >= 0; --p) {
    int v = cc[p];
    int c_all = cnt[v];
    if (c_all < need) continue;
    ans = min(ans, max(0, need - cnta[v]));
  }
  if (ans == INF)
    cout << -1;
  else
    cout << ans;
}
int main() {
  solve();
  return 0;
}
