#include <bits/stdc++.h>
const double pi = 3.1415926535897932384626433832795;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
using namespace std;
void ifd() {}
void tme() {}
int n, a, b, need, ans = 1000000;
map<int, int> up, down, sim;
map<int, int>::iterator it;
int main() {
  ifd();
  cin >> n;
  need = (n + 1) / 2;
  for (int i = (0); i < (n); ++i) {
    cin >> a >> b;
    up[a]++;
    down[b]++;
    if (a == b) sim[a]++;
  }
  for (it = up.begin(); it != up.end(); it++) {
    if (it->second + down[it->first] - sim[it->first] >= need) {
      ans = ((ans <= ((need - it->second >= 0) ? need - it->second : 0))
                 ? ans
                 : ((need - it->second >= 0) ? need - it->second : 0));
    }
  }
  for (it = down.begin(); it != down.end(); it++) {
    if (it->second + up[it->first] - sim[it->first] >= need) {
      ans =
          ((ans <=
            ((((need - up[it->first] >= 0) ? need - up[it->first] : 0) <=
              it->second)
                 ? ((need - up[it->first] >= 0) ? need - up[it->first] : 0)
                 : it->second))
               ? ans
               : ((((need - up[it->first] >= 0) ? need - up[it->first] : 0) <=
                   it->second)
                      ? ((need - up[it->first] >= 0) ? need - up[it->first] : 0)
                      : it->second));
    }
  }
  if (ans == 1000000)
    cout << "-1" << endl;
  else
    cout << ans << endl;
  tme();
  return 0;
}
