#include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector s(n); for(auto &&e: s) cin >> e; int z = 0; vector> l, r; for(int i = 0; i < n; ++i){ for(int j = 0; j < n; ++j){ if(s[i][j] == '#') l.emplace_back(make_pair(i, j)); } } for(int i = 0; i < n; ++i){ for(int j = n; j < n*2; ++j){ if(s[i][j] == '.') r.emplace_back(make_pair(i, j)); } } int lx = 0, ly = 0, rx = 0, ry = 0; for(auto[x, y]: l){ lx += x; ly += y; } for(auto[x, y]: r){ rx += x; ry += y; } //cout << lx << " : " << ly << " : " << rx << " : " << ry << '\n'; z = (rx - lx) + (ry - ly); cout << z << '\n'; return 0; }