#include <bits/stdc++.h>
using namespace std;
map<int, int> m1, m2;
set<int> s;
const int INF = 1e9;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    m1[x]++;
    m2[y]++;
    if (x == y) m2[y]--;
    s.insert(x);
    s.insert(y);
  }
  int r = n / 2 + n % 2;
  int ans = INF;
  for (auto it = s.begin(); it != s.end(); it++) {
    int num = 0;
    if (m1.find(*it) != m1.end()) num = m1[*it];
    if (num >= r) {
      cout << 0 << endl;
      return 0;
    }
    if (m2.find(*it) != m1.end() && num + m2[*it] >= r) ans = min(ans, r - num);
  }
  if (ans == INF)
    cout << -1 << endl;
  else
    cout << ans << endl;
}
