#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, lo = 0, lc = 0, ro = 0, rc = 0;
  cin >> n;
  while (n--) {
    long long l, r;
    cin >> l >> r;
    if (l == 0)
      lc++;
    else if (l == 1)
      lo++;
    if (r == 0)
      rc++;
    else if (r == 1)
      ro++;
  }
  cout << min(lo, lc) + min(ro, rc) << endl;
  return 0;
}
