#include <bits/stdc++.h>
using namespace std;
int N;
int A[100000];
int B[100000];
map<int, int> m;
int res = (1 << 29);
void solve(int x) {
  int tc = 0;
  for (int(i) = 0; (i) < (N); (i)++)
    if (A[i] == x) tc++;
  int hv = 0;
  for (int(i) = 0; (i) < (N); (i)++)
    if (A[i] != x && B[i] == x) hv++;
  int use = (N + 1) / 2 - tc;
  if (use > hv) return;
  res = min(res, max(0, use));
}
int main() {
  scanf("%d", &N);
  for (int(i) = 0; (i) < (N); (i)++)
    scanf("%d%d", &A[i], &B[i]), m[A[i]]++, m[B[i]]++;
  for (__typeof((m).begin()) it = (m).begin(); it != (m).end(); it++)
    if (it->second >= (N + 1) / 2) solve(it->first);
  printf("%d\n", (res + 1) % ((1 << 29) + 1) - 1);
}
