#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a, b;
  int acount0 = 0, acount1 = 0, bcount0 = 0, bcount1 = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a, &b);
    if (a == 1)
      ++acount1;
    else if (a == 0)
      ++acount0;
    if (b == 1)
      ++bcount1;
    else if (b == 0)
      ++bcount0;
  }
  int ans = min(acount1, acount0) + min(bcount1, bcount0);
  printf("%d\n", ans);
  return 0;
}
