#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 6;
const int maxlog = 20;
const long long inf = 1e18;
const int mod = 1e9 + 7;
const long long base = 307;
map<long long, int> cnt1, cnt2;
set<int> st;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int need = (n + 1) / 2;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    cnt1[x]++;
    if (y != x) cnt2[y]++;
    st.insert(x);
    st.insert(y);
  }
  int ans = mod;
  for (set<int>::iterator it = st.begin(); it != st.end(); it++) {
    int x = *it;
    int kol = cnt1[x] + cnt2[x];
    if (kol < need) continue;
    int new_need = need - cnt1[x];
    ans = min(ans, new_need);
  }
  if (ans == mod)
    cout << -1;
  else
    cout << max(0, ans);
  return 0;
}
