#include <bits/stdc++.h>
using namespace std;
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
const long long inf = 1e18;
const double pi = 3.14159265358979323846264338327950288419716939937510;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const double eps = (0.00000000001);
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
  uniform_int_distribution<int> uid(0, lim - 1);
  return uid(rang);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    pair<long long, long long>* arr = new pair<long long, long long>[n];
    for (long long i = 0; i < n; i++) {
      cin >> arr[i].first;
      cin >> arr[i].second;
    }
    long long leftOpen = 0;
    long long leftClose = 0;
    for (long long i = 0; i < n; i++) {
      if (arr[i].first == 0)
        leftClose++;
      else if (arr[i].first == 1)
        leftOpen++;
    }
    long long rightOpen = 0;
    long long rightClose = 0;
    for (long long i = 0; i < n; i++) {
      if (arr[i].second == 0)
        rightClose++;
      else if (arr[i].second == 1)
        rightOpen++;
    }
    cout << min(leftOpen, leftClose) + min(rightOpen, rightClose);
  }
  return 0;
}
