#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> f, s;
  set<int> n;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    f.push_back(a);
    if (a != b) s.push_back(b);
    n.insert(a);
    n.insert(b);
  }
  sort(f.begin(), f.end());
  sort(s.begin(), s.end());
  int obj = (N + 1) / 2;
  int res = (1 << 28);
  pair<vector<int>::iterator, vector<int>::iterator> range;
  for (set<int>::iterator it = n.begin(); it != n.end(); it++) {
    int sum = 0;
    range = equal_range(f.begin(), f.end(), *it);
    sum += range.second - range.first;
    range = equal_range(s.begin(), s.end(), *it);
    int t = range.second - range.first;
    if (sum + t < obj) continue;
    res = min(res, max(0, obj - sum));
  }
  if (res == (1 << 28))
    cout << "-1" << endl;
  else
    cout << res << endl;
}
