#include <bits/stdc++.h>
using namespace std;
map<int, int> mp1, mp2;
int a[111111], b[111111];
int n;
int MIN = 1e9;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    if (a[i] == b[i]) {
      mp1[a[i]]++;
    } else {
      mp1[a[i]]++;
      mp2[b[i]]++;
    }
  }
  map<int, int>::iterator it;
  for (it = mp1.begin(); it != mp1.end(); it++) {
    int t = it->first;
    if (mp1[t] >= (n + 1) / 2) {
      printf("0\n");
      return 0;
    }
    if (mp1[t] + mp2[t] < (n + 1) / 2)
      continue;
    else {
      int temp = (n + 1) / 2 - mp1[t];
      MIN = min(temp, MIN);
    }
  }
  for (it = mp2.begin(); it != mp2.end(); it++) {
    int t = it->first;
    if (mp2[t] >= (n + 1) / 2) {
      MIN = min((n + 1) / 2, MIN);
      break;
    }
  }
  if (MIN != 1e9)
    printf("%d\n", MIN);
  else
    printf("-1\n");
  return 0;
}
