n=int(input())
s=input()
w='.'
b='#'
ans=[]
bc=s.count(b)
wc=n-bc
WC=n-bc
BC=0
for i in range(n):
    if b==s[i]:
        if BC+WC<0:
            pass
        else:
            ans+=[BC+WC]
        BC+=1
    else:
        WC-=1
print(0 if ans==[] else min(ans))
