#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n{}, l{}, r{};
  long long int left_one{}, left_zero{}, right_one{}, right_zero{};
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> l >> r;
    if (l == 1) {
      left_one++;
    } else {
      left_zero++;
    }
    if (r == 1) {
      right_one++;
    } else {
      right_zero++;
    }
  }
  long long int count1{};
  count1 += (left_one > left_zero) ? left_zero : left_one;
  count1 += (right_one > right_zero) ? right_zero : right_one;
  cout << count1 << '\n';
}
