#include <bits/stdc++.h>
using namespace std;
map<int, int> a, b;
vector<int> val;
int n, l, r, ans, cur, color, goal;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &l, &r);
    if (a[l] == 0)
      a[l] = 1;
    else
      a[l]++;
    val.push_back(l);
    val.push_back(r);
    if (r != l)
      if (b[r] == 0)
        b[r] = 1;
      else
        b[r]++;
  }
  ans = -1;
  goal = (n + 1) / 2;
  for (size_t i = 0; i < val.size(); i++) {
    color = val[i];
    if (a[color] + b[color] < goal) continue;
    cur = max(0, goal - a[color]);
    if (ans == -1 || cur < ans) ans = cur;
  }
  cout << ans;
  return 0;
}
