#include <bits/stdc++.h>
using namespace std;
double PI = 3.14159265358979323843;
void Timo() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void print(int n) {
  if (n == 0) {
    return;
  }
  print(n - 1);
  cout << "Hello world" << endl;
  print(n - 1);
}
long long arr[100000];
int main() {
  Timo();
  vector<pair<int, int> > vec;
  int n, z, x;
  cin >> n;
  int O = 0, Z = 0;
  for (int i = 0; i < n; i++) {
    cin >> z >> x;
    vec.push_back(make_pair(z, x));
    if (vec[i].first == 1) {
      O++;
    }
    if (vec[i].second == 1) {
      Z++;
    }
  }
  cout << min(O, (n - O)) + min(Z, (n - Z));
  return 0;
}
