#include <bits/stdc++.h>
using namespace std;
int t[1111111];
int x[1111111];
int v[1111111], d[1111111];
int l[1111111];
int main() {
  int n;
  cin >> n;
  int m = (n + 1) / 2;
  memset(v, 0, sizeof(v));
  memset(d, 0, sizeof(d));
  memset(x, 0, sizeof(x));
  memset(t, 0, sizeof(t));
  memset(l, 0, sizeof(l));
  int k = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i] >> d[i];
    if (v[i] != d[i]) {
      t[k++] = v[i];
      t[k++] = d[i];
    } else
      t[k++] = v[i];
  }
  sort(t, t + k);
  int g = 0;
  int i, j;
  for (i = 0; i < k;) {
    int vis = 1;
    for (j = i + 1; j < k; j++) {
      if (t[i] == t[j])
        vis++;
      else
        break;
    }
    if (vis >= m) l[g++] = t[i];
    i = j;
  }
  int ans = -1;
  if (g == 0)
    cout << "-1" << endl;
  else {
    for (i = 0; i < g; i++) {
      int res = 0;
      for (j = 0; j < n; j++) {
        if (l[i] == v[j]) res++;
      }
      ans = max(ans, res);
    }
    if (ans >= m)
      cout << "0" << endl;
    else
      cout << m - ans << endl;
  }
  return 0;
}
