n=int(input()) s=input() R=n wait=-1 for i in range(n-1,-1,-1): if s[i]=='#': dx=R-i-1 if wait-dx>=0: R=R-1 wait=wait-dx+1 else: R=i wait=0 L=i print(n-L+wait)