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