#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  set<int> st;
  map<int, int> mp, um;
  for (long long i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    mp[x]++;
    if (x != y) um[y]++;
    st.insert(x);
    st.insert(y);
  }
  int m = INT_MAX;
  int x = ceil(n / 2.0);
  int f = 0;
  for (auto it : st) {
    if (mp[it] >= x) {
      m = min(m, 0);
      f++;
    } else {
      if (mp[it] + um[it] >= x) {
        m = min(m, x - mp[it]);
        f++;
      }
    }
  }
  if (f == 0)
    cout << "-1" << endl;
  else
    cout << m << endl;
}
