#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int D[n][2];
  int r = 0, l = 0;
  for (int i = 0; i < n; i++) {
    cin >> D[i][0] >> D[i][1];
    if (D[i][0] == 1) l++;
    if (D[i][1] == 1) r++;
  }
  int count = 0;
  if (r <= n / 2)
    count += r;
  else
    count += n - r;
  if (l <= n / 2)
    count += l;
  else
    count += n - l;
  cout << count;
}
