#include <bits/stdc++.h>
using namespace std;
int n, m, b[100000];
map<int, int> a;
vector<pair<int, int> > c;
int ans = (int)HUGE_VAL;
int main() {
  cin >> n;
  m = (n + 1) / 2;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    b[i] = x;
    if (x == y)
      a[x]++;
    else
      a[x]++, a[y]++;
  }
  for (map<int, int>::iterator iter = a.begin(); iter != a.end(); ++iter)
    c.push_back(make_pair(iter->second, iter->first));
  sort(c.begin(), c.end());
  for (int i = c.size() - 1; i >= 0 && c[i].first >= m; --i) {
    int cnt = 0;
    for (int j = 0; j < n; ++j)
      if (c[i].second == b[j]) cnt++;
    ans = min(ans, max(m - cnt, 0));
  }
  if (ans == (int)HUGE_VAL) ans = -1;
  cout << ans << endl;
  return 0;
}
