#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:128000000")
const int MAXN = 100010;
int n;
map<int, int> m;
int card[MAXN][2];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &card[i][0], &card[i][1]);
    if (card[i][0] == card[i][1])
      m[card[i][0]]++;
    else
      for (int j = 0; j < 2; j++) m[card[i][j]]++;
  }
  int mcnt = 1e9;
  int ok = false;
  for (auto it = m.begin(); it != m.end(); ++it) {
    if (it->second >= ((n + 1) / 2)) {
      ok = true;
      int cnt = 0;
      int ups = 0;
      for (int i = 0; i < n; i++) {
        if (card[i][0] == it->first) ups++;
      }
      cnt = max(0, (n + 1) / 2 - ups);
      mcnt = min(mcnt, cnt);
    }
  }
  if (ok)
    cout << mcnt;
  else
    cout << -1;
  return 0;
}
