N = int(input())
S = str(input())

S0 = S[0]
L = []
count = 1
Wk=[]
Bk=[]

for i in range(1,N):
    if S[i-1]!=S[i]:
        L.append(count)
        count =1

    else:
        count +=1
    if i ==N-1:
        L.append(count)

lenL=len(L)
Numw =0
Numb =0
Numx =0

if S0 == '.':
    Wk.append(L[0])
    Bk.append(0)
    if S[-1] =='.':
        for i in range(1,lenL):
            if i%2 == 0:
                Numw +=L[i]
                Wk.append(Wk[-1]+L[i])
                Bk.append(Bk[-1])

            else: 
                Numb +=L[i]
                Bk.append(Bk[-1]+L[i])
                Wk.append(Wk[-1])

        m=(min(Numw,Numb))

        tmp = float("inf")


        for k in range(lenL):
            s = Wk[k]+(Bk[-1]-Bk[k])
            tmp = min(tmp,s)
        print(min(tmp,m))
        
    else:

        for i in range(1,len(L)-1):
            if i%2 ==0:
                Numw +=L[i]
                Wk.append(Wk[-1]+L[i])
                Bk.append(Bk[-1])
            else:
                Numb +=L[i]
                Bk.append(Bk[-1]+L[i])
                Wk.append(Wk[-1])
        Bk.append(Bk[-1]+L[-1])

        m=(min(Numb,Numw))
        tmp = float("inf")


        for k in range(lenL):
            s = Wk[k]+(Bk[-1]-Bk[k])
            tmp = min(tmp,s)
        print(min(tmp,m))

         

else:
    if S[-1]=='.':
        for i in range(len(L)):
            if i%2 ==0:
                Numb += L[i]
                Bk.append(Bk[-1]+L[i])
                if Wk:
                    Wk.append(Wk[-1])
                else:
                    Wk.append(0)

            else:
                Numw += L[i]
                Bk.append(Bk[-1])
                if Wk:
                    Wk.append(Wk[-1]+L[i])
                else:
                    Wk.append(L[i])

        m=(min(Numb,Numw))
        tmp = float("inf")


        for k in range(lenL):
            s = Wk[k]+(Bk[-1]-Bk[k])
            tmp = min(tmp,s)
        print(min(tmp,m))

    else:
        for i in range(len(L)-1):
            if i%2 ==0:
                Numb += L[i]
                Bk.append(Bk[-1]+L[i])
                if Wk:
                    Wk.append(Wk[-1])
                else:
                    Wk.append(0)

            else:
                Numw += L[i]
                Bk.append(Bk[-1])
                if Wk:
                    Wk.append(Wk[-1]+L[i])
                else:
                    Wk.append(L[i])
        Bk.append(L[-1])      
        m=(min(Numb,Numw))
        tmp =float("inf")  


        for k in range(lenL):
            s = Wk[k]+(Bk[-1]-Bk[k])
            tmp = min(tmp,s)
        print(min(tmp,m))


