#include <bits/stdc++.h>
using namespace std;
int lo, lc, ro, rc;
int main() {
  int n;
  int t1, t2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t1 >> t2;
    if (t1)
      lo++;
    else
      lc++;
    if (t2)
      ro++;
    else
      rc++;
  }
  cout << min(lo, lc) + min(ro, rc);
  return 0;
}
