#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, b;
  int ca = 0, cb = 0, da = 0, db = 0;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 1)
      ca++;
    else
      cb++;
    if (b == 1)
      da++;
    else
      db++;
  }
  cout << min(ca, cb) + min(da, db);
}
