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