#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  int a[n], b[n];
  vector<int> z, x;
  map<int, int> q, w, e, r;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    q[a[i]]++;
    if (q[a[i]] == 1) {
      z.push_back(a[i]);
    }
    if (a[i] != b[i]) {
      w[b[i]]++;
    }
    e[b[i]]++;
    if (e[b[i]] == 1) {
      x.push_back(b[i]);
    }
  }
  int qwe = n / 2 + n % 2;
  for (int i = 0; i < z.size(); i++) {
    if (q[z[i]] >= qwe) {
      cout << 0;
      return 0;
    }
  }
  int ans = 1e9;
  for (int i = 0; i < z.size(); i++) {
    if (q[z[i]] + w[z[i]] >= qwe) {
      ans = min(ans, qwe - q[z[i]]);
    }
  }
  for (int i = 0; i < x.size(); i++) {
    if (q[x[i]] + w[x[i]] >= qwe) {
      ans = min(ans, qwe - q[x[i]]);
    }
  }
  if (ans == 1e9) {
    cout << -1;
    return 0;
  }
  cout << ans;
  return 0;
}
