#include <bits/stdc++.h>
using namespace std;
long long n, a, b;
vector<pair<long long, long long> > vv;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t1 = 0, t2 = 0, t3 = 0, t4 = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    vv.push_back(make_pair(a, b));
  }
  for (long long i = 0; i < n; i++) {
    if (vv[i].first) ++t1;
    if (!vv[i].second) ++t1;
    if (!vv[i].first) ++t2;
    if (vv[i].second) ++t2;
    if (vv[i].first) ++t3;
    if (vv[i].second) ++t3;
    if (!vv[i].first) ++t4;
    if (!vv[i].second) ++t4;
  }
  cout << min(min(t1, t2), min(t3, t4)) << "\n";
}
