#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> m1, m2;
  set<int> s;
  int n, x, y, mn = 1000000007;
  cin >> n;
  int n1 = n / 2 + n % 2;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    s.insert(x);
    m1[x]++;
    if (y != x) {
      s.insert(y);
      m2[y]++;
    }
  }
  set<int>::iterator it = s.begin();
  for (it; it != s.end(); it++) {
    int temp = *it;
    if (m1[temp] >= n1) {
      cout << "0\n";
      return 0;
    }
    int k = n1 - m1[temp];
    if (m2[temp] >= k) {
      mn = min(mn, k);
    }
  }
  if (mn != 1000000007)
    cout << mn << endl;
  else
    cout << "-1\n";
}
