#include <bits/stdc++.h>
using namespace std;
set<long long int> ccolors;
const int N = 1e5 + 10;
vector<pair<long long int, long long int>> ccards;
map<long long int, long long int> backwards;
map<long long int, long long int> forwards;
set<long long int> wassB;
set<long long int> wassF;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long int a, b;
    cin >> a >> b;
    ccolors.insert(a);
    ccolors.insert(b);
    if (wassF.count(a) > 0) {
      forwards[a]++;
    } else {
      forwards[a] = 1;
    }
    wassF.insert(a);
    if (a == b) continue;
    if (wassB.count(b) > 0) {
      backwards[b]++;
    } else {
      backwards[b] = 1;
    }
    wassB.insert(b);
  }
  long long int ans = N;
  long long int nHalf = n / 2 + n % 2;
  while (!ccolors.empty()) {
    long long int curColor = *ccolors.begin();
    ccolors.erase(curColor);
    if (forwards[curColor] + backwards[curColor] < nHalf) continue;
    ans = min(ans, nHalf - forwards[curColor]);
  }
  if (ans == N) {
    cout << "-1\n";
    return 0;
  }
  if (ans <= 0) {
    cout << "0\n";
    return 0;
  }
  cout << ans << endl;
  return 0;
}
