#include <bits/stdc++.h>
using namespace std;
int n;
map<int, pair<int, int> > m;
int main() {
  scanf("%i", &n);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%i%i", &a, &b);
    if (m.find(a) == m.end())
      m[a] = make_pair(1, 0);
    else
      m[a].first += 1;
    if (b != a)
      if (m.find(b) == m.end())
        m[b] = make_pair(0, 1);
      else
        m[b].second += 1;
  }
  int ans = 1e9;
  for (map<int, pair<int, int> >::iterator it = m.begin(); it != m.end(); it++)
    if (it->second.first + it->second.second >= (n + 1) / 2)
      ans = min(ans, max(0, (n + 1) / 2 - it->second.first));
  if (ans == 1e9)
    cout << -1;
  else
    cout << ans;
  return 0;
}
