#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
const long long mod = 998244353;
int n, a[maxn], b[maxn], ans = 1e9;
map<int, int> m1, m2;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    m1[a[i]]++;
    if (a[i] == b[i]) continue;
    m2[b[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (m1[a[i]] + m2[a[i]] >= (n + 1) / 2) {
      ans = min(ans, max(0, (n + 1) / 2 - m1[a[i]]));
    }
    if (m1[b[i]] + m2[b[i]] >= (n + 1) / 2) {
      ans = min(ans, max(0, (n + 1) / 2 - m1[b[i]]));
    }
  }
  if (ans == 1e9)
    printf("-1\n");
  else
    printf("%d\n", ans);
}
