#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int left, right;
  int l0 = 0, l1 = 0, r0 = 0, r1 = 0;
  for (int i = 0; i < n; i++) {
    cin >> left >> right;
    if (left == 0) {
      l0++;
    } else
      l1++;
    if (right == 0) {
      r0++;
    } else
      r1++;
  }
  int l = min(l0, l1);
  int r = min(r0, r1);
  cout << l + r;
}
