#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long t, q;
  long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0,
            j = 0, k = 0, l = 0, m = 0, n = 0, o = 0, r = 0, u = 0, w = 0,
            x = 0, y = 0, z = 0;
  long long flag = 0, flag1 = 0, co = 0, co1 = 0, co2 = 0, co3 = 0, x1 = 0,
            x2 = 0, y1 = 0, y2 = 0, z1 = 0, z2 = 0;
  long long ma = 0, mi = 100000000;
  long long mid = 0, temp = 0, stop = 0, start = 0, ans = 0;
  double pi = 3.141592653589793;
  double d1 = 0.0, d2, d3, d4;
  vector<long long> v, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10;
  vector<string> vs, vs1, vs2, vs3, vs4;
  vector<pair<long long, long long> > vp, vp1, vp2;
  char ch, ch1, ch2[1001];
  string str, str1, str2, str3, str4, str5;
  pair<long long, long long> pa;
  list<long long> li, li1;
  map<long long, long long> mp, mp1;
  set<long long> st;
  map<long long, long long>::iterator imll;
  vector<long long>::iterator ivl, low, up;
  set<long long>::iterator it;
  vector<pair<long long, long long> >::iterator ivp;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a >> b, v.push_back(a), v1.push_back(b);
  for (i = 0; i < n; i++) {
    if (v[i] == 1)
      x++;
    else
      y++;
  }
  if (x <= y)
    ans += x;
  else
    ans += y;
  x = 0, y = 0;
  for (i = 0; i < n; i++) {
    if (v1[i] == 1)
      x++;
    else
      y++;
  }
  if (x <= y)
    ans += x;
  else
    ans += y;
  cout << ans << endl;
  return 0;
}
