#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e7 + 15;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long LLF = 0x3f3f3f3f3f3f3f3fLL;
const int MAXn = 7e5 + 15;
const int MAX = 100010;
map<long long, long long> mp, ans;
struct node {
  int a, b;
} a[MAX];
int main() {
  int n;
  scanf("%d", &n);
  int k = (n + 1) / 2, min1 = INF, cnt = 0, flag = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i].a, &a[i].b);
    if (a[i].a == a[i].b) {
      mp[a[i].b]++;
    } else {
      mp[a[i].a]++;
      mp[a[i].b]++;
    }
    if (mp[a[i].a] == k) {
      flag = 1;
      ans[cnt++] = a[i].a;
    }
    if (mp[a[i].b] == k) {
      flag = 1;
      ans[cnt++] = a[i].b;
    }
  }
  if (!flag) {
    printf("-1\n");
  } else {
    for (int i = 0; i < cnt; i++) {
      int sum = 0;
      for (int j = 0; j < n; j++) {
        if (a[j].a == ans[i]) sum++;
      }
      int m = k - sum;
      if (m <= 0) {
        printf("0\n");
        return 0;
      } else {
        if (min1 > m) min1 = m;
      }
    }
    printf("%d\n", min1);
  }
  return 0;
}
