#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, zeroe = 0, zerod = 0, ume = 0, umd = 0, total = 0;
  cin >> n;
  while (n--) {
    int a, b;
    cin >> a >> b;
    if (a == 0) zeroe++;
    if (a == 1) ume++;
    if (b == 0) zerod++;
    if (b == 1) umd++;
  }
  if (zeroe < ume)
    total += zeroe;
  else
    total += ume;
  if (zerod < umd)
    total += zerod;
  else
    total += umd;
  cout << total << "\n";
  return 0;
}
