#include <bits/stdc++.h>
using namespace std;
map<int, pair<int, int>> mp;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == b)
      mp[a].first++;
    else
      mp[a].first++, mp[b].second++;
  }
  int res = -1;
  for (auto x : mp) {
    int num = x.first;
    int t1 = x.second.first, t2 = x.second.second;
    if (t1 + t2 < n / 2 + n % 2) continue;
    if (t1 >= n / 2 + n % 2)
      res = 0;
    else
      res = ((res == -1) ? n / 2 + n % 2 - t1 : min(res, n / 2 + n % 2 - t1));
  }
  cout << res << "\n";
}
