#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  map<int, int> front, back, both;
  vector<int> colors;
  for (int i = 0; i < n; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    ++front[a];
    ++back[b];
    if (a == b) {
      ++both[a];
    }
    colors.push_back(a);
    colors.push_back(b);
  }
  int ans = n + 1;
  for (int i = 0; i < 2 * n; ++i) {
    int c = colors[i];
    int need = (n + 1) / 2 - front[c];
    if (need <= 0) {
      ans = 0;
    } else {
      if (back[c] - both[c] >= need) {
        if (need < ans) {
          ans = need;
        }
      }
    }
  }
  printf("%d\n", (ans == n + 1 ? -1 : ans));
  return 0;
}
