#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int left, right, c1_1 = 0, c1_0 = 0, c2_1 = 0, c2_0 = 0;
  for (int i = 0; i < n; i++) {
    cin >> left >> right;
    left == 1 ? c1_1++ : c1_0++;
    right == 1 ? c2_1++ : c2_0++;
  }
  cout << (min(c1_0, c1_1)) + (min(c2_0, c2_1));
}
