#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  solve();
  return 0;
}
void solve() {
  int n;
  cin >> n;
  map<int, int> front;
  map<int, int> back;
  for (int i = 0; i < n; i++) {
    int f, b;
    cin >> f >> b;
    if (front.find(f) == front.end())
      front[f] = 1;
    else
      front[f]++;
    if (back.find(b) == back.end())
      back[b] = 1;
    else
      back[b]++;
    if (f == b) back[b]--;
  }
  int ans = 1000000;
  map<int, int>::iterator it;
  for (it = front.begin(); it != front.end(); it++) {
    if ((*it).second >= (n + 1) / 2)
      ans = 0;
    else {
      if ((*it).second + back[(*it).first] >= (n + 1) / 2)
        ans = min(ans, (n + 1) / 2 - (*it).second);
    }
  }
  for (it = back.begin(); it != back.end(); it++) {
    if ((front[(*it).first]) >= (n + 1) / 2)
      ans = 0;
    else {
      if ((*it).second + front[(*it).first] >= (n + 1) / 2)
        ans = min(ans, (n + 1) / 2 - front[(*it).first]);
    }
  }
  if (ans == 1000000)
    cout << "-1";
  else
    cout << ans << "\n";
}
