_n=int(input())
_s=input()
t=len([1 for s in _s if s=="."])
c=[]
c.append((t,0))
for n in range(_n):
    if _s[n]=="#":
        t+=1
    else:
        t-=1
    c.append((t,n+1))
c.sort()
print(c[0][0])
