# coding: utf-8
# Your code here!
N=int(input())
S=list(input())
N=len(S)

turn=0
kuro=0
shiro=0
last=0

ans=0
for index,item in enumerate(S):
    if item==".":
        kuro+=1
        last=0
    else:
        shiro+=1
        last+=1
    if kuro>shiro:
        turn=index
        ans=shiro-kuro

print(min(ans+kuro,shiro-last))#乱暴スギィ

