
N=int(input())
S=input()


lst = [0]

c1 = S.count(".")
c2 = S.count("#")

if c1<=c2:
    for i in range(N):
        if S[i:i+2]=="#.":
            lst.append(lst[i]+1)
            S=S[:i+1]+"#"+S[i+2:]
        else:
            lst.append(lst[i])
    print(lst[-1])
else:
    for i in range(N-1,-1,-1):
        if S[i:i+2]=="#.":
            lst.append(lst[N-1-i]+1)
            S=S[:i]+"."+S[i+1:]
        else:
            lst.append(lst[N-1-i])

    print(max(lst))
