#include <bits/stdc++.h>
using namespace std;
set<long long int> s;
set<long long int>::iterator it;
map<long long int, long long int> m1, m2;
int main() {
  long long int i, j, k, l, n, m;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j >> k;
    s.insert(j);
    s.insert(k);
    if (j != k) {
      m1[j]++;
      m2[k]++;
    } else
      m1[j]++;
  }
  long long int ans = 9999999999;
  for (it = s.begin(); it != s.end(); it++) {
    if (m1[*it] >= (n / 2 + n % 2)) {
      cout << 0;
      return 0;
    }
    if (m1[*it] + m2[*it] >= (n / 2 + n % 2))
      ans = min(ans, (n / 2 + n % 2) - m1[*it]);
  }
  if (ans != 9999999999)
    cout << ans;
  else
    cout << -1;
}
