#include <bits/stdc++.h>
using namespace std;
int n, a[100005], b[100005];
map<int, int> f, s;
vector<int> q;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    f[a[i]]++;
    s[a[i]]++;
    q.push_back(a[i]);
    if (a[i] != b[i]) {
      s[b[i]]++, q.push_back(b[i]);
    }
  }
  int ans = 1e8;
  for (vector<int>::iterator i = q.begin(); i < q.end(); i++)
    if (s[*i] >= (n + 1) / 2) {
      if (f[*i] >= (n + 1) / 2) {
        ans = 0;
        break;
      }
      if (ans > (n + 1) / 2 - f[*i]) ans = (n + 1) / 2 - f[*i];
    }
  if (ans == 1e8)
    printf("-1");
  else
    printf("%d", ans);
  return 0;
}
