#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int n, a, b, c, d, x, y;
  a = b = c = d = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    if (x)
      ++a;
    else
      ++c;
    if (y)
      ++b;
    else
      ++d;
  }
  int ans = min(a, c) + min(b, d);
  cout << ans;
  return 0;
}
