#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007, M = 3e5 + 7;
long long powe(long long x, long long y) {
  x = x % mod;
  long long ans = 1;
  while (y > 0) {
    if (y & 1) {
      ans = (1ll * x * ans) % mod;
    }
    y >>= 1;
    x = (1ll * x * x) % mod;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, a, b;
  cin >> n;
  int arr[n][2];
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    arr[i][0] = a;
    arr[i][1] = b;
  }
  map<int, int> up, down;
  for (int i = 0; i < n; i++) {
    up[arr[i][0]]++;
    if (arr[i][1] != arr[i][0]) down[arr[i][1]]++;
  }
  int mini = INT_MAX, req = n / 2 + n % 2;
  for (auto x : up) {
    if (x.second >= req) {
      mini = 0;
      continue;
    }
    if (down.count(x.first) && down[x.first] + x.second >= req) {
      mini = min(mini, req - x.second);
    }
  }
  for (auto x : down) {
    if (x.second >= req) {
      mini = min(mini, req);
    }
  }
  if (mini == INT_MAX)
    cout << -1;
  else
    cout << mini;
  return 0;
}
