#include <bits/stdc++.h>
int main() {
  int n, l, r, l1 = 0, l0 = 0, r1 = 0, r0 = 0, time, x, y;
  scanf("%d", &n);
  while (n--) {
    scanf("%d %d", &l, &r);
    if (l == 1) {
      l1++;
    } else if (l == 0) {
      l0++;
    }
    if (r == 1) {
      r1++;
    } else if (r == 0) {
      r0++;
    }
  }
  if (l1 > l0) {
    x = l0;
  } else {
    x = l1;
  }
  if (r1 > r0) {
    y = r0;
  } else {
    y = r1;
  }
  time = x + y;
  printf("%d\n", time);
  return 0;
}
