#include <bits/stdc++.h>
using namespace std;
map<int, int> cl;
int up[200002], dn[200002];
int main() {
  int n, a, b, C = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    if (cl.find(a) == cl.end()) cl[a] = C++;
    if (cl.find(b) == cl.end()) cl[b] = C++;
    a = cl[a];
    b = cl[b];
    if (a == b)
      up[a]++;
    else
      up[a]++, dn[b]++;
  }
  int ans = 1000000000, ND = n / 2 + n % 2;
  for (int i = 0; i < C; ++i) {
    if (up[i] + dn[i] >= ND) {
      if (ND - up[i] <= 0)
        ans = 0;
      else
        ans = min(ans, ND - up[i]);
    }
  }
  if (ans == 1000000000)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
