#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, ans = 1000000000, n, num, f = 0;
  map<int, int> m1;
  map<int, int> m2;
  map<int, int>::iterator it;
  cin >> n;
  num = (n + 1) / 2;
  for (i = 0; i < n; i++) {
    cin >> j >> k;
    m1[j]++;
    if (j != k) m2[k]++;
  }
  for (it = m1.begin(); it != m1.end(); it++) {
    if (it->second >= num) {
      ans = 0;
      f = 1;
      break;
    } else {
      if ((it->second + m2[it->first]) >= num) ans = min(ans, num - it->second);
    }
  }
  if (f == 0)
    for (it = m2.begin(); it != m2.end(); it++) {
      if (it->second >= num) ans = min(ans, num);
    }
  if (ans == 1000000000) ans = -1;
  cout << ans;
}
