n=int(input()) s=input() a=-1 for i in range(n): if s[~i]=="#": a=max(a+2,n-i) print(a)