#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  while (cin >> n) {
    int l, r;
    int lc = 0, lo = 0, rc = 0, ro = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &l, &r);
      if (l == 0)
        lc++;
      else
        lo++;
      if (r == 0)
        rc++;
      else
        ro++;
    }
    cout << min(lc, lo) + min(rc, ro) << endl;
  }
  return 0;
}
