#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t1, t2, mn = INT_MAX, needed, mntmp, minus;
  scanf("%d", &n);
  needed = ceil((double)n / 2);
  map<int, int> freq;
  map<int, int> freq2;
  map<int, int> dups;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &t1, &t2);
    if (freq.find(t1) != freq.end()) {
      freq[t1]++;
    } else {
      freq.insert(pair<int, int>(t1, 1));
    }
    if (freq2.find(t2) != freq2.end() && t1 != t2) {
      freq2[t2]++;
    } else if (t1 != t2) {
      freq2.insert(pair<int, int>(t2, 1));
    }
  }
  map<int, int>::iterator i;
  map<int, int>::iterator i2;
  i = freq.begin();
  while (i != freq.end()) {
    if (freq2[i->first] + i->second >= needed) {
      mntmp = needed - i->second;
      if (mntmp < 0) mntmp = 0;
      mn = min(mn, mntmp);
    }
    i++;
  }
  if (mn == INT_MAX) {
    i = freq2.begin();
    while (i != freq2.end()) {
      if (i->second >= needed) mn = needed;
      i++;
    }
  }
  if (mn == INT_MAX)
    cout << -1;
  else
    cout << mn;
  return 0;
}
