#include <bits/stdc++.h>
using namespace std;
int dir[] = {0, 1, 0, -1, 1, 0, -1, 0};
void solve() {
  int n;
  cin >> n;
  map<int, int> cnt1, cnt2;
  for (int i = 0; i < n; i++) {
    int num1, num2;
    cin >> num1 >> num2;
    cnt1[num1]++;
    cnt2[num1]++;
    if (num1 != num2) cnt2[num2]++;
  }
  int mn = -1;
  for (auto x : cnt2) {
    int need = max(0, (n / 2) + (n % 2) - cnt1[x.first]);
    if (cnt2[x.first] >= need + cnt1[x.first]) {
      if (mn == -1) mn = need;
      mn = min(mn, need);
    }
  }
  cout << mn << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  int t = 1;
  for (int cn = 1; cn <= t; cn++) {
    solve();
  }
  return 0;
}
