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