using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int max = 0; max = Math.Max(max, chk1(0,0,0)); max = Math.Max(max, chk1(0,1,0)); max = Math.Max(max, chk1(0,0,1)); max = Math.Max(max, chk1(1,0,1)); max = Math.Max(max, chk1(0,N-1,1)); max = Math.Max(max, chk1(1,N-1,1)); max = Math.Max(max, chk1(N-1,0,0)); max = Math.Max(max, chk1(N-1,1,0)); max = Math.Max(max, chk2(0)); max = Math.Max(max, chk2(1)); max = Math.Max(max, chkrot(0)); max = Math.Max(max, chkrot(1)); Console.WriteLine(max); } int chk1(int r, int c, int dir){ int cnt = 0; switch(dir){ case 0: { // horizontal bool chk = true; for(int j=c;j<c+N-1;j++) chk &= M[r][j] == '.'; if(chk) cnt++; for(int j=0;j<N;j++){ bool chk2 = true; for(int i=0;i<N;i++){ if(i == r) continue; chk2 &= M[i][j] == '.'; } if(chk2) cnt++; } } break; case 1: { // vertical bool chk = true; for(int i=r;i<r+N-1;i++) chk &= M[i][c] == '.'; if(chk) cnt++; for(int i=0;i<N;i++){ bool chk2 = true; for(int j=0;j<N;j++){ if(j == c) continue; chk2 &= M[i][j] == '.'; } if(chk2) cnt++; } } break; } return cnt; } int chk2(int dir){ int cnt = 0; switch(dir){ case 0: { // horizontal for(int i=0;i<N;i++){ int cnt0 = 0; for(int j=0;j<N;j++){ if(M[i][j] == '.') cnt0++; } if(cnt0 == N) cnt++; if(cnt0 == N-1){ if(M[i][0] == ',' || M[i][N-1] == ',') cnt++; } } } break; case 1: { // vertical for(int j=0;j<N;j++){ int cnt0 = 0; for(int i=0;i<N;i++){ if(M[i][j] == '.') cnt0++; } if(cnt0 == N) cnt++; if(cnt0 == N-1){ if(M[0][j] == ',' || M[N-1][j] == ',') cnt++; } } } break; } return cnt; } int chkrot(int dir){ int cnt = 0; switch(dir){ case 0: { bool chk = true; for(int j=0;j<N-1;j++) chk &= M[0][j] == '.'; if(chk) cnt++; chk = true; for(int i=0;i<N-1;i++) chk &= M[i][N-1] == '.'; if(chk) cnt++; chk = true; for(int j=1;j<N;j++) chk &= M[N-1][j] == '.'; if(chk) cnt++; chk = true; for(int i=1;i<N;i++) chk &= M[i][0] == '.'; if(chk) cnt++; } break; case 1: { bool chk = true; for(int j=1;j<N;j++) chk &= M[0][j] == '.'; if(chk) cnt++; chk = true; for(int i=1;i<N;i++) chk &= M[i][N-1] == '.'; if(chk) cnt++; chk = true; for(int j=0;j<N-1;j++) chk &= M[N-1][j] == '.'; if(chk) cnt++; chk = true; for(int i=0;i<N-1;i++) chk &= M[i][0] == '.'; if(chk) cnt++; } break; } return cnt; } int N; String[] M; public Sol(){ N = ri(); M = new String[N]; for(int i=0;i<N;i++) M[i] = rs(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }