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