N=int(input())
S=input()
R=S[::-1]
cb=0
B=[]
sb="$"
for s in S:
    if s=='.' and sb=='#':
        B.append(cb)
    if s=='#':
        cb+=1
    sb=s
cw=0
W=[]
sb="$"
for s in R:
    if s=="#" and sb=='.':
            W.append(cw)
    if s=='.':
        cw+=1
    sb=s

W=W[::-1]

result=N
for b, w in zip(B, W):
    #print(b, w)
    result=min(result, b+w-1)
if result==N:
    result = 0
print(result)
