N=int(input())
S=input()
whi=0
bla=0
c1=0
for i in S:
    if i=="#":
        break
    c1+=1
for i in S:
    if i==".":
        whi+=1
    else:
        bla+=1
if whi==0 or bla==0:
    print(0)
    quit()
c2=0
for i in S[::-1]:
    if i==".":
        break
    c2+=1

print(min(whi-c1,bla-c2))
