import sys input = sys.stdin.readline N=int(input()) MAP=[list(input().strip()) for i in range(N)] flag=1 for i in range(N): if MAP[0][i]=="#": flag=0 if MAP[0][N-1]=="#": flag=0 if MAP[i][0]=="#": flag=0 if MAP[N-1][0]=="#": flag=0 if flag==1: ANS=4 else: ANS=0 for ix in range(N): if not ("#" in MAP[ix][0:N-1]): for j in range(N-1): MAP[ix][j]="#" score=1 for j in range(N): x=0 for i in range(N): if MAP[i][j]==".": x+=1 else: x=0 if x>=N-1: score+=1 break ANS=max(ANS,score) for j in range(N-1): MAP[ix][j]="." if not ("#" in MAP[ix][1:N]): for j in range(1,N): MAP[ix][j]="#" score=1 for j in range(N): x=0 for i in range(N): if MAP[i][j]==".": x+=1 else: x=0 if x>=N-1: score+=1 break ANS=max(ANS,score) for j in range(1,N): MAP[ix][j]="." score=0 for i in range(N): if not ("#" in MAP[i][1:N]) or not ("#" in MAP[i][0:N-1]): score+=1 ANS=max(ANS,score) MAP2=[["."]*N for i in range(N)] for i in range(N): for j in range(N): if MAP[i][j]=="#": MAP2[N-1-j][i]="#" MAP=MAP2 for ix in range(N): if not ("#" in MAP[ix][0:N-1]): for j in range(N-1): MAP[ix][j]="#" score=1 for j in range(N): x=0 for i in range(N): if MAP[i][j]==".": x+=1 else: x=0 if x>=N-1: score+=1 break ANS=max(ANS,score) for j in range(N-1): MAP[ix][j]="." if not ("#" in MAP[ix][1:N]): for j in range(1,N): MAP[ix][j]="#" score=1 for j in range(N): x=0 for i in range(N): if MAP[i][j]==".": x+=1 else: x=0 if x>=N-1: score+=1 break ANS=max(ANS,score) for j in range(1,N): MAP[ix][j]="." score=0 for i in range(N): if not ("#" in MAP[i][1:N]) or not ("#" in MAP[i][0:N-1]): score+=1 ANS=max(ANS,score) print(ANS)