#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e5 + 10;
const int INF = (int)2e9;
int cards[MAXN][2];
int main() {
  int i, j, n, need, ans = INF, have;
  map<int, int> count;
  map<int, int>::iterator it;
  vector<int> v;
  cin >> n;
  need = (n % 2) ? (n / 2 + 1) : (n / 2);
  for (i = 0; i < n; ++i) {
    scanf("%d%d", &cards[i][0], &cards[i][1]);
    ++count[cards[i][0]];
    if (cards[i][0] != cards[i][1]) ++count[cards[i][1]];
  }
  for (it = count.begin(); it != count.end(); ++it)
    if ((*it).second >= need) v.push_back((*it).first);
  for (i = 0; i < v.size(); ++i) {
    have = 0;
    for (j = 0; j < n; ++j) {
      if (cards[j][0] == v[i]) ++have;
    }
    ans = (have >= need) ? 0 : min(ans, need - have);
  }
  cout << ((ans == INF) ? -1 : ans);
  return 0;
}
