#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[10000], b[10000];
  int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    cin >> b[i];
  }
  int r1 = 0, r0 = 0, l0 = 0, l1 = 0, m;
  for (i = 0; i < n; i++) {
    if (a[i] == 1)
      l1++;
    else
      l0++;
    m = (l1 < l0 ? l1 : l0);
    if (b[i] == 1)
      r1++;
    else
      r0++;
    m += (r1 < r0 ? r1 : r0);
  }
  cout << m;
}
