#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int l, r;
  int ol = 0, opr = 0;
  int i = n;
  while (n--) {
    cin >> l >> r;
    if (l) ol++;
    if (r) opr++;
  }
  int res = 0;
  if (ol > i / 2)
    res = i - ol;
  else
    res = ol;
  if (opr > i / 2)
    res += (i - opr);
  else
    res += opr;
  cout << res << endl;
  return 0;
}
