#include <bits/stdc++.h>
using namespace std;
void precompute(void) {}
int main() {
  int t, ans, i, temp1, temp2;
  map<int, int> front, back;
  set<int> num;
  precompute();
  while (scanf("%d", &t) != EOF) {
    front.clear();
    back.clear();
    num.clear();
    for (i = 0; i < t; i++) {
      scanf("%d %d", &temp1, &temp2);
      num.insert(temp1);
      num.insert(temp2);
      front[temp1]++;
      if (temp2 != temp1) back[temp2]++;
    }
    ans = 1000000000;
    for (typeof(num.begin()) tr = num.begin(); tr != num.end(); tr++) {
      temp1 = *tr;
      if (front[temp1] + back[temp1] >= (t + 1) / 2) {
        ans = min(ans, (t + 1) / 2 - front[temp1]);
      }
    }
    if (ans < 0) ans = 0;
    if (ans == 1000000000) ans = -1;
    printf("%d\n", ans);
  }
  return 0;
}
