import sys input = sys.stdin.readline N=int(input()) MAP=[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 score=0 for i in range(N): if not ("#" in MAP[i][0:N-1]): score+=1 flag=1 for i in range(N-1): if MAP[i][N-1]=="#": flag=0 if flag==0: flag=1 for i in range(1,N): if MAP[i][N-1]=="#": flag=0 ANS=max(ANS,score+flag) score=0 for i in range(N): if not ("#" in MAP[i][1:N]): score+=1 flag=1 for i in range(N-1): if MAP[i][0]=="#": flag=0 if flag==0: flag=1 for i in range(1,N): if MAP[i][0]=="#": flag=0 ANS=max(ANS,score+flag) 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 score=0 for i in range(N): if not ("#" in MAP[i][0:N-1]): score+=1 flag=1 for i in range(N-1): if MAP[i][N-1]=="#": flag=0 if flag==0: flag=1 for i in range(1,N): if MAP[i][N-1]=="#": flag=0 ANS=max(ANS,score+flag) score=0 for i in range(N): if not ("#" in MAP[i][1:N]): score+=1 flag=1 for i in range(N-1): if MAP[i][0]=="#": flag=0 if flag==0: flag=1 for i in range(1,N): if MAP[i][0]=="#": flag=0 ANS=max(ANS,score+flag) 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)