#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  while (scanf("%ld", &n) != EOF) {
    int a, b, c1 = 0, c2 = 0, s1 = 0, s2 = 0, i, r;
    long x = 100000000;
    for (i = 0; i < n; i++) {
      scanf("%d%d", &a, &b);
      if (a == 0)
        c1++;
      else
        c2++;
      if (b == 0)
        s1++;
      else
        s2++;
    }
    r = c2;
    r = r + s1;
    if (r < x) x = r;
    r = c1;
    r = r + s2;
    if (r < x) x = r;
    r = c2 + s2;
    if (r < x) x = r;
    r = c1 + s1;
    if (r < x) x = r;
    printf("%ld\n", x);
  }
  return 0;
}
