#include <bits/stdc++.h>
using namespace std;
struct tree {
  int color = -1;
  int amount;
  tree* left = NULL;
  tree* right = NULL;
};
void addToTree(tree* top, int data) {
  if (top->color == -1) {
    top->color = data;
    top->amount = 1;
    return;
  }
  if (data == top->color) {
    top->amount++;
    return;
  }
  if (data > top->color)
    if (top->right)
      addToTree(top->right, data);
    else {
      tree* p = new tree;
      p->color = data;
      p->amount = 1;
      top->right = p;
    }
  else if (top->left)
    addToTree(top->left, data);
  else {
    tree* p = new tree;
    p->color = data;
    p->amount = 1;
    top->left = p;
  }
  return;
}
tree* search(tree* top, int data) {
  if (top == NULL) return NULL;
  if (top->color == data) return top;
  if (data > top->color)
    search(top->right, data);
  else
    search(top->left, data);
}
int getAmount(tree* top, int data) {
  tree* p = search(top, data);
  if (p == NULL) return 0;
  return p->amount;
}
void traversal(tree* topO, tree* topT, int& res, int n) {
  if (!topO) return;
  if (topO->color == -1) return;
  int t = ceil(n * 1.0 / 2);
  topO->right;
  topO->right->color;
  if (topO->amount + getAmount(topT, topO->color) >= t)
    res = min(res, max(0, t - topO->amount));
  traversal(topO->left, topT, res, n);
  traversal(topO->right, topT, res, n);
}
void traversalBack(tree* topO, tree* topT, int& res, int n) {
  if (!topO) return;
  if (topO->color == -1) return;
  int t = ceil(n * 1.0 / 2);
  topO->right;
  topO->right->color;
  if (topO->amount + getAmount(topT, topO->color) >= t)
    res = min(res, max(0, t - getAmount(topT, topO->color)));
  traversalBack(topO->left, topT, res, n);
  traversalBack(topO->right, topT, res, n);
}
struct d {
  int x;
  int y;
};
int main() {
  d tmp;
  vector<d> arr;
  int n;
  cin >> n;
  tree topOne, topTwo;
  int x, y;
  int res = n + 1;
  for (int i = 0; i < 2 * n; i = i + 2) {
    cin >> tmp.x >> tmp.y;
    arr.push_back(tmp);
  }
  random_shuffle(arr.begin(), arr.end());
  for (int i = 0; i < n; i++) {
    x = arr[i].x;
    y = arr[i].y;
    addToTree(&topOne, x);
    if (x != y) addToTree(&topTwo, y);
  }
  traversal(&topOne, &topTwo, res, n);
  traversalBack(&topTwo, &topOne, res, n);
  if (res == n + 1)
    cout << -1;
  else
    cout << res;
}
