#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  map<long long int, long long int> front, back;
  vector<pair<long long int, long long int>> vp;
  long long int req = (n + 1) / 2;
  for (long long int i = 0; i < n; i++) {
    long long int f, b;
    cin >> f >> b;
    vp.push_back({f, b});
    front[f]++;
    if (f != b) back[b]++;
  }
  long long int ans = 1e18;
  for (auto it : front) {
    long long int f = it.second;
    if (f >= req) {
      cout << 0;
      return 0;
    }
    long long int b = back[it.first];
    if (f + b >= req) ans = min(ans, req - f);
  }
  for (auto it : back) {
    long long int b = it.second;
    long long int f = front[it.first];
    if (f + b >= req) ans = min(ans, req - f);
  }
  if (ans == 1e18)
    cout << -1;
  else
    cout << ans;
}
