#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, ans, x, y, z, req;
  map<long long int, long long int> up, down;
  ans = 10000000000000;
  cin >> n;
  long long int a[n + 1], b[n + 1];
  if (n % 2 == 0)
    req = n / 2;
  else
    req = n / 2 + 1;
  for (i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    up[a[i]]++;
    if (a[i] != b[i]) down[b[i]]++;
  }
  for (i = 1; i <= n; i++) {
    x = a[i];
    y = up[a[i]];
    z = req - y;
    if (z <= 0)
      ans = 0;
    else if (down[a[i]] >= z)
      ans = min(ans, z);
  }
  for (i = 1; i <= n; i++) {
    x = b[i];
    y = up[b[i]];
    z = req - y;
    if (z <= 0)
      ans = 0;
    else if (down[b[i]] >= z)
      ans = min(ans, z);
  }
  if (ans == 10000000000000)
    cout << "-1";
  else
    cout << ans;
  return 0;
}
