#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  int n;
  cin >> n;
  map<int, int> M1, M2, M;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    M1[x]++, M2[y]++;
    if (x == y) M[x]++;
  }
  map<int, int>::iterator it;
  int Res = 1e9;
  for (it = M1.begin(); it != M1.end(); ++it) {
    int a = it->first;
    int b = it->second;
    int p = n / 2 + (n & 1) - b;
    if (p <= 0)
      Res = 0;
    else {
      int x = p;
      p -= (M2[a] - M[a]);
      if (p <= 0) Res = min(Res, x);
    }
  }
  if (Res == 1e9) {
    for (it = M2.begin(); it != M2.end(); it++) {
      int a = it->second, b = n / 2 + (n % 2 != 0);
      if (a >= b) {
        Res = b;
        break;
      }
    }
    if (Res == 1e9) Res = -1;
  }
  cout << Res << "\n";
  return 0;
}
