#include <bits/stdc++.h>
using namespace std;
map<int, int> cnt;
map<int, int> fnt;
int main() {
  int n, flag = 0;
  set<int> store;
  set<int>::iterator it;
  scanf("%d", &n);
  int half = n / 2;
  if (n % 2 == 1) half++;
  for (int i = 1; i <= n; i++) {
    int f, b;
    scanf("%d %d", &f, &b);
    if (f != b) {
      cnt[f]++;
      cnt[b]++;
    } else
      cnt[b]++;
    fnt[f]++;
    if (cnt[f] >= half) {
      store.insert(f);
      flag = 1;
    }
    if (cnt[b] >= half) {
      store.insert(b);
      flag = 1;
    }
  }
  if (flag == 0)
    printf("-1\n");
  else {
    int mn = INT_MAX;
    for (it = store.begin(); it != store.end(); it++) {
      mn = min(mn, (half - fnt[*it]));
    }
    if (mn < 0) mn = 0;
    printf("%d\n", mn);
  }
  return 0;
}
