#include using namespace std; #define int long long #define stoi stoll using ll=long long; using vi=vector; using pii=pair; #define ALL(c) begin(c),end(c) #define RALL(c) rbegin(c),rend(c) #define ITR(i,b,e) for(auto i=(b);i!=(e);++i) #define FORE(x,c) for(auto &x:c) #define REPF(i,a,n) for(int i=a,i##len=(int)(n);i=0;--i) #define SZ(c) ((int)c.size()) #define CONTAIN(c,x) (c.find(x)!=end(c)) #define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w) #define dump(...) const signed INF_=1001001001; const ll INF=1001001001001001001LL; const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0}; template ostream& operator<<(ostream &os,const vector &v) { ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;} template istream& operator>>(istream &is,vector &v) { ITR(i,begin(v),end(v)) is>>*i;return is;} template istream& operator>>(istream &is, pair &p) { is>>p.first>>p.second;return is;} template bool chmax(T &a,const T &b){if(a bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;} template using heap=priority_queue,greater>; struct{template operator T(){T x;cin>>x;return x;}} IN; struct before_main_function { before_main_function() { cin.tie(0);ios::sync_with_stdio(false); cout< S(N); cin>>S; vector> p(N,vector(N,true)); REP(i,N) REP(j,N) p[i][j]=S[i][j]!='#'; int ans=0; vector pos={{0,0},{0,1},{1,0},{1,1}}; vector dir(4,0); function dfs=[&](int idx,int cnt) { if(idx==4) { auto q=p; REP(t,2) { int tmp=cnt; p=q; auto X=[&]() { REP(i,2) { REPF(j,2,N) { if(p[i][j]) { bool f=true; REP(k,N-1) if(!p[i+k][j]) f=false; if(f) { REP(k,N-1) p[i+k][j]=false; tmp++; } } } } }; auto Y=[&]() { REP(j,2) { REPF(i,2,N) { if(p[i][j]) { bool f=true; REP(k,N-1) if(!p[i][j+k]) f=false; if(f) { REP(k,N-1) p[i][j+k]=false; tmp++; } } } } }; if(t==0) {X(),Y();} else {Y(),X();} chmax(ans,tmp); } return; } int y=pos[idx].first,x=pos[idx].second; auto q=p; if(p[y][x]) { REP(d,2) { bool f=true; REP(k,N-1) { if(d==0) { if(!p[y][x+k]) f=false; } else { if(!p[y+k][x]) f=false; } } if(f) { REP(k,N-1) { if(d==0) p[y][x+k]=false; else p[y+k][x]=false; } dir[idx]=d+1; dfs(idx+1,cnt+1); p=q; } } } dir[idx]=0; dfs(idx+1,cnt); }; dfs(0,0); cout<