#include <bits/stdc++.h>
using namespace std;
long long one(string s) {
  long long k = 0, c = 1;
  for (long long p = 0; p < s.size(); p++) {
    k += ((c + '0') != s[p]);
    c = 1 - c;
  }
  return k;
}
long long ze(string s) {
  long long k = 0, c = 0;
  for (long long p = 0; p < s.size(); p++) {
    k += ((c + '0') != s[p]);
    c = 1 - c;
  }
  return k;
}
int main() {
  long long t, i, j, k, ans, m, n, x, y;
  t = 1;
  while (t--) {
    cin >> n;
    string s, a = "", b = "", c = "", d = "";
    for (long long p = 0; p < n; p++) {
      cin >> s;
      a += s;
    }
    for (long long p = 0; p < n; p++) {
      cin >> s;
      b += s;
    }
    for (long long p = 0; p < n; p++) {
      cin >> s;
      c += s;
    }
    for (long long p = 0; p < n; p++) {
      cin >> s;
      d += s;
    }
    vector<long long> o, z;
    o.push_back(one(a));
    o.push_back(one(b));
    o.push_back(one(c));
    o.push_back(one(d));
    z.push_back(ze(a));
    z.push_back(ze(b));
    z.push_back(ze(c));
    z.push_back(ze(d));
    sort(o.begin(), o.end());
    sort(z.begin(), z.end());
    cout << o[0] + o[1] + z[0] + z[1];
  }
  return 0;
}
