#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a1 = 0, b1 = 0, a0 = 0, b0 = 0, t = 0;
  cin >> n;
  int a[n];
  int b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 1)
      a1++;
    else
      a0++;
    if (b[i] == 1)
      b1++;
    else
      b0++;
  }
  if (a1 > a0)
    t += a0;
  else
    t += a1;
  if (b1 > b0)
    t += b0;
  else
    t += b1;
  cout << t;
  return 0;
}
