#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, -1, 1, 1, 1, -1, -1};
int dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};
void TimeElapsed() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  fast();
  int n;
  cin >> n;
  int mn = 2 * n;
  map<int, int> mp_u;
  map<int, int> mp_d;
  map<int, bool> vis;
  int u, d;
  for (int i = 0; i < n; i++) {
    cin >> u >> d;
    if (u != d) {
      vis[u] = vis[d] = true;
      mp_u[u]++;
      mp_d[d]++;
    } else {
      vis[u] = true;
      mp_u[u]++;
    }
  }
  int target = (n + 1) / 2;
  for (auto it : vis) {
    if (mp_u[it.first] + mp_d[it.first] >= target)
      mn = min(mn, target - mp_u[it.first]);
  }
  if (mn != 2 * n)
    cout << max(mn, 0);
  else
    cout << -1;
}
