#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v;
map<int, int> a, b;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  int m = n / 2;
  if (n % 2 != 0) {
    m++;
  }
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    a[x]++;
    if (x != y) {
      b[y]++;
    }
    v.push_back(x);
    v.push_back(y);
  }
  int ans = 1e9;
  for (int i = 0; i < 2 * n; i++) {
    int cur = v[i];
    int cnt = a[cur];
    int need = max(0, m - cnt);
    if (b[cur] >= need) {
      ans = min(ans, need);
    }
  }
  if (ans == 1e9) {
    cout << -1;
    return 0;
  }
  cout << ans;
}
