#include <bits/stdc++.h>
using namespace std;
int a, b, c, k, i, t, n;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a >> b;
    c = c + a;
    k = k + b;
  }
  if (c < n - c)
    t = t + c;
  else
    t = t + n - c;
  if (k < n - k)
    t = t + k;
  else
    t = t + n - k;
  cout << t;
}
