#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
int main() {
  ios_base::sync_with_stdio(0);
  int n, l, r, a, b;
  cin >> n;
  l = r = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    l += a;
    r += b;
  }
  cout << min(min(l + r, n - l + r), min(2 * n - l - r, n - r + l)) << "\n";
  return 0;
}
