N=int(input())
S=input()
S=S+'9'
w=0
b=0
n=S[0]
ans=0
for s in S:
    if s=='#':
        b+=1
    else:
        w+=1
    if n!=s:
        if n=='.':
            if b<w:
                ans+=b
            else:
                ans+=w
            b=0
            w=0
        n=s
print(ans)