import sys
import math
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()
N = ni()
S = ns()

#最初のBが出てくるまでを数える
fastB = False
fastW = False
secondB=False
w0,w1,b0,b1 = 0,0,0,0

for s in S:
    if(s=="."):
        #print("w")
        if(fastB and fastW):
            secondB=True
            w1+=1
        else:
            fastW=True
            w0+=1
    elif(s=="#"):
        #print("b")
        if(fastB and fastW and secondB):
            b1+=1
        else:
            fastB=True
            fastW=True
            b0+=1
w=True
res=0
for s in S[::-1]:
    if(s=="#"):
        if(w):
            res+=1
        else:
            break
    else:
        w=False


#print(b0+b1,w0+w1,w1)
#print(b0,b1,w0,w1)

print(min(b0+b1-res,w0+w1,w1))