#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, z1 = 0, o1 = 0, z2 = 0, o2 = 0, s;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int a, b;
    cin >> a >> b;
    if (a == 0)
      z1++;
    else if (a == 1)
      o1++;
    if (b == 0)
      z2++;
    else if (b == 1)
      o2++;
  }
  s = min(z1, o1) + min(z2, o2);
  cout << s << endl;
}
