#include <bits/stdc++.h>
using namespace std;
int x, y, n, i, lo = 0, lc = 0, ro = 0, rc = 0;
int main() {
  cin >> n;
  while (n--) {
    cin >> x >> y;
    if (x == 0)
      lc++;
    else
      lo++;
    if (y == 0)
      rc++;
    else
      ro++;
  }
  int ans = min(lo, lc) + min(ro, rc);
  cout << ans << endl;
  return 0;
}
