def Run_Length_Encoding(S): """ランレングス圧縮 S:文字列 """ if not S: return [] R=[[S[0],1]] for i in range(1,len(S)): if R[-1][0]==S[i]: R[-1][1]+=1 else: R.append([S[i],1]) return R #================================================== N=int(input()) S=list(input()) a=0 for i in range(N): if S[i]=="#": a=i break b=0 R=Run_Length_Encoding(S) for s,r in R: if s=="#": b=max(b,r) print((N-a)+b-1)