#include <bits/stdc++.h>
using namespace std;
int A[2][2];
int main() {
  int d, i, n;
  cin >> n;
  int k = n;
  int cd = 0, ud = 0, c_i = 0, u_i = 0;
  while (k--) {
    cin >> i >> d;
    if (i == 0)
      c_i++;
    else
      u_i++;
    if (d == 0)
      cd++;
    else
      ud++;
  }
  cout << min(c_i, u_i) + min(cd, ud) << endl;
  return 0;
}
