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 = Bk[k]+(Wk[-1]-Wk[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])
        if Bk:
            Bk.append(Bk[-1]+L[-1])
        else:
            Bk.append(L[-1])
        if Wk:
            Wk.append(Wk[-1])
        else:
            Wk.append(0)

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


        for k in range(lenL):
            s =Bk[k]+(Wk[-1]-Wk[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]
                if Bk:
                    Bk.append(Bk[-1]+L[i])
                else:
                    Bk.append(L[i])
                if Wk:
                    Wk.append(Wk[-1])
                else:
                    Wk.append(0)

            else:
                Numw += L[i]
                if Bk:
                    Bk.append(Bk[-1])
                else:
                    Bk.append(0)
                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 = Bk[k]+(Wk[-1]-Wk[k])
            tmp = min(tmp,s)
        print(min(tmp,m))

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

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


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


### FIXED CODE ###

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

S0 = S[0]
L = []
count = 1
Wk=[]
Bk=[]
if N>1:
    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)
else:
    L.append(1)
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 = Bk[k]+(Wk[-1]-Wk[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])
        if Bk:
            Bk.append(Bk[-1]+L[-1])
        else:
            Bk.append(L[-1])
        if Wk:
            Wk.append(Wk[-1])
        else:
            Wk.append(0)

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

        for k in range(lenL):
            s = Bk[k]+(Wk[-1]-Wk[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]
                if Bk:
                    Bk.append(Bk[-1]+L[i])
                else:
                    Bk.append(L[i])
                if Wk:
                    Wk.append(Wk[-1])
                else:
                    Wk.append(0)

            else:
                Numw += L[i]
                if Bk:
                    Bk.append(Bk[-1])
                else:
                    Bk.append(0)
                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 = Bk[k]+(Wk[-1]-Wk[k])
            tmp = min(tmp,s)
        print(min(tmp,m))

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

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


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