#include <bits/stdc++.h>
using namespace std;
int n, a[100005], b[100005];
map<int, pair<int, int>> color;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    color[a[i]].first++;
    color[a[i]].second++;
    if (a[i] != b[i]) {
      color[b[i]].first++;
    }
  }
  int ans = INT_MAX;
  for (auto it : color) {
    if (it.second.first * 2 >= n)
      ans = min(ans, max(0, (n + 1) / 2 - it.second.second));
  }
  cout << (ans == INT_MAX ? -1 : ans) << '\n';
  return 0;
}
