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

f = 0
w = 0
b = 0
b2 = 0
sb = '$'
for s in S:
    if s=='.' and sb=='#':
        f=1

    if f and s=='.':
        w+=1

    if s=='#':
        b+=1
        b2+=1
    else:
        b2=0
    sb=s

print(min(w, b-b2))
