#include <bits/stdc++.h>
using namespace std;
struct node {
  int front, back;
} color[200010];
int n, m;
map<int, int> mp;
int main() {
  int tmp1, tmp2, c;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < 200010; i++) color[i].back = color[i].front = 0;
    mp.clear();
    c = 1;
    for (int i = 0; i < n; i++) {
      scanf("%d", &tmp1);
      if (mp[tmp1] == 0) mp[tmp1] = c++;
      color[mp[tmp1]].front++;
      scanf("%d", &tmp2);
      if (tmp2 == tmp1) continue;
      if (mp[tmp2] == 0) mp[tmp2] = c++;
      color[mp[tmp2]].back++;
    }
    int ans = 1e9;
    for (int i = 1; i < c; i++) {
      if (color[i].front + color[i].back >= (n + 1) / 2) {
        int need = (n + 1) / 2 - color[i].front;
        if (need < 0) need = 0;
        if (need < ans) ans = need;
      }
    }
    if (ans == 1e9)
      puts("-1");
    else
      printf("%d\n", ans);
  }
  return 0;
}
