Buggy python submission (verdict: Time Limit Exceeded):
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.insert(0,a)
    wn.append(b)
bn.append(0)
wn.insert(0,0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Fixed submission:
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
wn.append(0)
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.append(a)
    wn.append(b)

bn.reverse()
bn.append(0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Buggy python submission (verdict: Time Limit Exceeded):
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.insert(0,a)
    wn.append(b)
bn.append(0)
wn.insert(0,0)
#print(bn)
#print(wn)

#score算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Fixed submission:
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
wn.append(0)
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.append(a)
    wn.append(b)

bn.reverse()
bn.append(0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Buggy python submission (verdict: Time Limit Exceeded):
N=input()
s=input()

N=int(N)
score=[]
wn=[]
bn=[]
a=0
b=0

for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.insert(0,a)
    wn.append(b)
bn.append(0)
wn.insert(0,0)
#print(bn)
#print(wn)

#score算出
min=1000000
a=0
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Fixed submission:
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
wn.append(0)
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.append(a)
    wn.append(b)

bn.reverse()
bn.append(0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Buggy python submission (verdict: Time Limit Exceeded):
N=input()
s=input()

N=int(N)
score=[]
wn=[]
bn=[]
a=0
b=0

for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.insert(0,a)
    wn.append(b)
bn.append(0)
wn.insert(0,0)
#print(bn)
#print(wn)

#score算出
a=0
for i in range(N+1):
    score.append(bn[i]+wn[i])

score.sort()
print(score[0])

Fixed submission:
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
wn.append(0)
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.append(a)
    wn.append(b)

bn.reverse()
bn.append(0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Buggy python submission (verdict: Time Limit Exceeded):
N=input()
s=input()

N=int(N)
score=[]
bn=[]
a=0

if(s[N-1]=="."):
    a+=1
    bn.insert(0,a)
else:
    bn.insert(0,0)

for i in range(1,N):
    j=N-1-i
    if(s[j]=="."):
        a+=1
    bn.insert(0,a)
bn.append(0)
#print(bn)

#score算出
a=0
for i in range(N):
    now=bn[i]
    now+=a
    score.append(now)
    if(s[i]=="#"):
        a+=1
score.append(a)

score.sort()
print(score[0])

Fixed submission:
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
wn.append(0)
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.append(a)
    wn.append(b)

bn.reverse()
bn.append(0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Buggy python submission (verdict: Time Limit Exceeded):
N=input()
s=input()

N=int(N)
score=[]
bn=[]
a=0

if(s[N-1]=="."):
    a+=1
    bn.insert(0,a)
else:
    bn.insert(0,0)

for i in range(1,N):
    j=N-1-i
    if(s[j]=="."):
        a+=1
    bn.insert(0,a)
bn.append(0)
#print(bn)

#score算出
a=0
for i in range(N):
    now=bn[i]
    now+=a
    score.append(now)
    if(s[i]=="#"):
        a+=1
score.append(a)

score.sort()
print(score[0])

Fixed submission:
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
wn.append(0)
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.append(a)
    wn.append(b)

bn.reverse()
bn.append(0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)