Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
B=True
if s=='.'*n:
    B=False
if B:
    num=list(s).index('#')
    if num!=n-1:
        for i in range(num,n-1):
            if s[i]=='.' and s[i+1]=='#':
                A=True
                l=n-i-1
        moji=s[num:]
        lst=dict(Counter(moji).items())
        a=lst['#'];b=lst['.']
        if a==0 or b==0:
            print(0)
        else:
            if s[-1]=='#':
                print(min(a-l,b))
            else:
                print(min(a,b))
    else:
        print(0)
else:
    print(0)


Fixed submission:
n=int(input())
s=input()
bres=0
wres=0
blst=[]
wlst=[]
for i in range(n):
    if s[i]=='#':
        bres+=1
    blst.append(bres)
for i in range(n-1,-1,-1):
    if s[i]=='.':
        wres+=1
    wlst.append(wres)
wlst=wlst[::-1]
ans=10**9
blst.insert(0,0)
wlst.insert(n,0)
for i in range(n+1):
    ans=min(blst[i]+wlst[i],ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
B=True
if s=='.'*n:
    B=False
if B:
    num=list(s).index('#')
    for i in range(n-1):
        if s[i:]=='#'*(n-i):
            A=True
            l=n-i
            break
    if num!=n-1:
        moji=s[num:]
        lst=dict(Counter(moji).items())
        a=lst['#'];b=lst['.']
        if a==0 or b==0:
            print(0)
        else:
            if A:
                print(min(a-l,b))
            else:
                print(min(a,b))
    else:
        print(0)
else:
    print(0)


Fixed submission:
n=int(input())
s=input()
bres=0
wres=0
blst=[]
wlst=[]
for i in range(n):
    if s[i]=='#':
        bres+=1
    blst.append(bres)
for i in range(n-1,-1,-1):
    if s[i]=='.':
        wres+=1
    wlst.append(wres)
wlst=wlst[::-1]
ans=10**9
blst.insert(0,0)
wlst.insert(n,0)
for i in range(n+1):
    ans=min(blst[i]+wlst[i],ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
s=input()
A=False
for i in range(n-1):
    if s[i]=='#':
        num=i
        A=True
        break
if A:
    moji=s[num:]
    lst=dict(Counter(moji).items())
    a=lst['#'];b=lst['.']

    if a==0 or b==0:
        print(0)
    else:
        if s[-1]=='#':
            print(min(a-1,b))
        else:
            print(min(a,b))
else:
    print(0)

Fixed submission:
n=int(input())
s=input()
bres=0
wres=0
blst=[]
wlst=[]
for i in range(n):
    if s[i]=='#':
        bres+=1
    blst.append(bres)
for i in range(n-1,-1,-1):
    if s[i]=='.':
        wres+=1
    wlst.append(wres)
wlst=wlst[::-1]
ans=10**9
blst.insert(0,0)
wlst.insert(n,0)
for i in range(n+1):
    ans=min(blst[i]+wlst[i],ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
A=False
for i in range(n-1):
    if s[i]=='#':
        num=i
        A=True
        break
if A:
    moji=s[num:]
    lst=dict(Counter(moji).items())
    a=lst['#'];b=lst['.']

    if a==0 or b==0:
        print(0)
    else:
        if s[-1]=='#':
            print(min(a-1,b))
        else:
            print(min(a,b))
else:
    print(0)
 

Fixed submission:
n=int(input())
s=input()
bres=0
wres=0
blst=[]
wlst=[]
for i in range(n):
    if s[i]=='#':
        bres+=1
    blst.append(bres)
for i in range(n-1,-1,-1):
    if s[i]=='.':
        wres+=1
    wlst.append(wres)
wlst=wlst[::-1]
ans=10**9
blst.insert(0,0)
wlst.insert(n,0)
for i in range(n+1):
    ans=min(blst[i]+wlst[i],ans)
print(ans)