#include <bits/stdc++.h>
using namespace std;
int maximum(int a, int b) {
  if (a > b)
    return a;
  else
    return b;
}
map<int, int> frontt, backk;
int a[100001], b[100001];
int main() {
  bool moguce = false;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, i, minimum = -1, pola, br;
  cin >> n;
  if (n % 2 == 0)
    pola = n / 2;
  else
    pola = n / 2 + 1;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] != b[i]) {
      frontt[a[i]]++;
      backk[b[i]]++;
    } else
      frontt[a[i]]++;
  }
  for (i = 0; i < n; i++) {
    if (frontt[a[i]] + backk[a[i]] >= pola) {
      br = maximum(pola - frontt[a[i]], 0);
      if (moguce == false) {
        moguce = true;
        minimum = br;
      } else if (br < minimum)
        minimum = br;
    }
    if (frontt[b[i]] + backk[b[i]] >= pola) {
      br = maximum(pola - frontt[b[i]], 0);
      if (moguce == false) {
        moguce = true;
        minimum = br;
      } else if (br < minimum)
        minimum = br;
    }
  }
  cout << minimum << endl;
  return 0;
}
