#include <bits/stdc++.h>
using namespace std;
const int MAXX = 1e5 + 10, inf = 1e9 + 10;
int n, ans, ans1, ans2;
pair<int, int> a[MAXX];
map<int, int> mp1, mp2;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n, ans = inf;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    mp1[a[i].first]++, mp2[a[i].second]++;
    if (a[i].first == a[i].second) mp2[a[i].second]--;
  }
  for (int i = 0; i < n; i++) {
    int x = (n + 1) / 2 - mp1[a[i].first];
    int y = (n + 1) / 2 - mp1[a[i].second];
    ans1 = (x <= 0) ? 0 : inf;
    ans2 = (y <= 0) ? 0 : inf;
    if (ans1 == inf && mp2.count(a[i].first) && mp2[a[i].first] >= x) ans1 = x;
    if (ans2 == inf && mp2.count(a[i].second) && mp2[a[i].second] >= y)
      ans2 = y;
    ans = min(ans, min(ans1, ans2));
  }
  return cout << ((ans == inf) ? -1 : ans) << endl, 0;
}
