#include <bits/stdc++.h>
using namespace std;
map<int, int> front;
map<int, int> back;
int main() {
  int n, a, b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    front[a]++;
    front[b];
    if (a != b) back[b]++;
  }
  int ans = -1;
  for (auto x : front) {
    if (x.second + back[x.first] >= (n + 1) / 2)
      if (ans == -1 || (n + 1) / 2 - x.second < ans)
        ans = max(0, (n + 1) / 2 - x.second);
  }
  cout << ans << endl;
}
