#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l1 = 0, l0 = 0, r1 = 0, r0 = 0, lmin = 0, rmin = 0;
  cin >> n;
  int left[10000], right[10000];
  for (int i = 0; i < n; i++) {
    cin >> left[i];
    cin >> right[i];
  }
  for (int i = 0; i < n; i++) {
    if (left[i] == 1)
      l1++;
    else
      l0++;
    if (right[i] == 1)
      r1++;
    else
      r0++;
  }
  lmin = min(l1, l0);
  rmin = min(r1, r0);
  cout << lmin + rmin << endl;
  return 0;
}
