Buggy python submission (verdict: Runtime Error):
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 submission:
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))

Buggy python submission (verdict: Runtime Error):
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 submission:
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))

Buggy python submission (verdict: Runtime Error):
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))




Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())

S0 = S[0]
L = []
count = 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)

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

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

            else: 
                Numb +=L[i]
        m=(min(Numw,Numb))

        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i+1]
            for i in range(k,int(lenL/2)):
                counter +=L[2*i]
            tmp = min(tmp,counter)
        print(min(m,tmp))


    else:
        for i in range(1,len(L)-1):
            if i%2 ==0:
                Numw +=L[i]
            else:
                Numb +=L[i]
        m=(min(Numb,Numw))
        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i+1]
            for i in range(k,int(lenL/2)-1):
                counter +=L[2*i]
            tmp = min(tmp,counter)
        print(min(m,tmp))
            

else:
    if S[-1]=='.':
        for i in range(len(L)):
            if i%2 ==0:
                Numb += L[i]
            else:
                Numw += L[i]
        m=(min(Numb,Numw))
        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i]
            for i in range(k,int(lenL/2)-1):
                counter +=L[2*i+1]
            tmp = min(tmp,counter)
        print(min(m,tmp))

    else:
        for i in range(len(L)-1):
            if i%2 ==0:
                Numb += L[i]
            else:
                Numw += L[i]
        m=(min(Numb,Numw))
        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i]
            for i in range(k,int(lenL/2)-1):
                counter +=L[2*i+1]
            tmp = min(tmp,counter)
        print(min(m,tmp))



Fixed submission:
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))

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())

S0 = S[0]
L = []
count = 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)
#print(L)
Numw =0
Numb =0
Numx =0

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

            else: 
                Numb +=L[i]
        m=(min(Numw,Numb))

        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i+1]
            for i in range(k,int(N/2)):
                counter +=L[2*i]
            tmp = min(tmp,counter)
        print(min(m,tmp))


    else:
        for i in range(1,len(L)-1):
            if i%2 ==0:
                Numw +=L[i]
            else:
                Numb +=L[i]
        m=(min(Numb,Numw))
        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i+1]
            for i in range(k,int(N/2)-1):
                counter +=L[2*i]
            tmp = min(tmp,counter)
        print(min(m,tmp))
            

else:
    if S[-1]=='.':
        for i in range(len(L)):
            if i%2 ==0:
                Numb += L[i]
            else:
                Numw += L[i]
        m=(min(Numb,Numw))
        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i]
            for i in range(k,int(N/2)-1):
                counter +=L[2*i+1]
            tmp = min(tmp,counter)
        print(min(m,tmp))

    else:
        for i in range(len(L)-1):
            if i%2 ==0:
                Numb += L[i]
            else:
                Numw += L[i]
        m=(min(Numb,Numw))
        tmp =float("inf")

        for k in range(len(L)):
            counter = 0
            for i in range(k):
                counter += L[2*i]
            for i in range(k,int(N/2)-1):
                counter +=L[2*i+1]
            tmp = min(tmp,counter)
        print(min(m,tmp))



Fixed submission:
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))