#include <bits/stdc++.h>
using namespace std;
map<int, int> mm;
map<int, int>::iterator mi;
int b[10];
int a[1000005][2];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i][0], &a[i][1]);
    mi = mm.find(a[i][0]);
    if (mi == mm.end()) {
      mm.insert(pair<int, int>(a[i][0], 1));
    } else {
      mi->second++;
    }
    if (a[i][0] != a[i][1]) {
      mi = mm.find(a[i][1]);
      if (mi == mm.end()) {
        mm.insert(pair<int, int>(a[i][1], 1));
      } else {
        mi->second++;
      }
    }
  }
  mi = mm.begin();
  while (mi != mm.end()) {
    if (mi->second >= (n + 1) / 2) {
      b[0]++;
      b[b[0]] = mi->first;
    }
    mi++;
  }
  int ans = -1;
  for (int i = 1; i <= b[0]; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++)
      if (a[j][0] == b[i]) sum++;
    int ans1;
    if (sum >= (n + 1) / 2)
      ans1 = 0;
    else
      ans1 = (n + 1) / 2 - sum;
    if (ans == -1 || ans > ans1) ans = ans1;
  }
  printf("%d\n", ans);
  return 0;
}
