#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int l = 0, r = 0, t = 0;
  int cup[n][2];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> cup[i][j];
    }
  }
  for (int i = 0, j = 0; i < n; i++) {
    if (cup[i][j] == 1) {
      l++;
    }
  }
  if (l <= n / 2) {
    t += l;
  } else {
    t += n - l;
  }
  for (int i = 0, j = 1; i < n; i++) {
    if (cup[i][j] == 1) {
      r++;
    }
  }
  if (r <= n / 2) {
    t += r;
  } else {
    t += n - r;
  }
  cout << t;
  return 0;
}
