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

ans=0
k=0
s=0
for i in range(len(S)):
    if S[i]=='#':
        k+=1

        if i==len(S)-1:
            break

    if S[i]=='.' and ('#' in S[:S.index('.')]):
        s+=1

        if i==len(S)-1:
            ans+=min(s,k)
            k=0
            s=0
            break

        if i+1=='#':
            ans+=min(s,k)
            k=0
            s=0
        
print(ans)
