#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m, a, b, r, s, ss, t, tt, j, i, p, pp;
  cin >> n;
  for (i = 1, s = 0, ss = 0, p = 0, pp = 0; i <= n; i++) {
    cin >> a >> b;
    if (a == 0)
      s++;
    else
      ss++;
    if (b == 0)
      p++;
    else
      pp++;
  }
  if (s < ss)
    t = s;
  else
    t = ss;
  if (p < pp)
    tt = p;
  else
    tt = pp;
  t = tt + t;
  cout << t << "\n";
  return 0;
}
