#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> c;
const int maxn = 100010;
int f[maxn], b[maxn];
int main() {
  while (scanf("%d", &n) != EOF) {
    c.clear();
    for (int i = 0; i < n; i++) {
      scanf("%d %d", &f[i], &b[i]);
      c[f[i]]++;
      if (b[i] != f[i]) c[b[i]]++;
    }
    int ret = -1;
    for (map<int, int>::iterator it = c.begin(); it != c.end(); it++) {
      if (it->second < (n + 1) / 2) continue;
      int tmp = 0;
      for (int i = 0; i < n; i++)
        if (f[i] == it->first) tmp++;
      if (tmp >= (n + 1) / 2)
        tmp = 0;
      else
        tmp = (n + 1) / 2 - tmp;
      if (ret == -1 || ret > tmp) ret = tmp;
    }
    printf("%d", ret);
  }
  return 0;
}
