#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, l[2] = {0}, r[2] = {0}, i, s = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    l[a]++;
    r[b]++;
  }
  cout << min(l[0], l[1]) + min(r[0], r[1]);
}
