#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
vector<ll> prime_factors(ll num) {
  vector<ll> ans;
  while (num % 2) {
    ans.push_back(2);
    num /= 2;
  }
  for (int i = 3; i * i <= num; i += 2) {
    while (num % i == 0) {
      ans.push_back(i);
      num /= i;
    }
  }
  if (num > 2) ans.push_back(num);
  return ans;
}
const ld pi = 3.14159265358979323846;
void tests() {
  int n;
  cin >> n;
  int zero_left = 0, zero_right = 0;
  int one_left = 0, one_right = 0;
  while (n--) {
    bool a, b;
    cin >> a >> b;
    if (a)
      one_left++;
    else
      zero_left++;
    if (b)
      one_right++;
    else
      zero_right++;
  }
  cout << min(one_left, zero_left) + min(one_right, zero_right) << char(10);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    tests();
  }
  return 0;
}
