#include <bits/stdc++.h>
const int N = 1e5 + 5;
using namespace std;
int main() {
  int n, c = 0, x[N], y[N], m[N];
  map<int, int> m1, m2;
  cin >> n;
  m[0] = -1;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    if (x[i] != y[i]) {
      m1[x[i]]++;
      m2[y[i]]++;
    } else {
      m1[x[i]]++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (m1[x[i]] >= ((n + 1) / 2)) {
      cout << 0 << endl;
      return 0;
    } else if (m1[x[i]] < ((n + 1) / 2) &&
               (m1[x[i]] + m2[x[i]]) >= ((n + 1) / 2)) {
      m[c] = ((n + 1) / 2) - m1[x[i]];
      c++;
    } else if (m1[y[i]] < ((n + 1) / 2) && m2[y[i]] >= ((n + 1) / 2)) {
      m[c] = ((n + 1) / 2) - m1[y[i]];
      c++;
    }
  }
  sort(m, m + c);
  cout << m[0] << endl;
  return 0;
}
