Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_c

N = int(input())
S = str(input())
Sarray = list(S)
Sarraynum = []

#白0
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        Sarraynum.append(0)
    else:
        Sarraynum.append(1)

a = 0
for i in range(len(Sarraynum)):
    a += Sarraynum[i]
a = len(Sarraynum) - a
for i in range(len(Sarraynum)):
    b = 0
    jmax = len(Sarraynum) - i - 1
    if jmax < i:
        jmax = i
    c = int(len(Sarraynum) / 2)
    for j in range(c,jmax):
        if j <= i:
            b += Sarraynum[j]
        if i + 1 + j < len(Sarraynum):
            if Sarraynum[i + 1 + j] == 0:
                b += 1
        if b >= a:
            break

    for j in range(c):
        if j <= i:
            b += Sarraynum[j]
        if i + 1 + j < len(Sarraynum):
            if Sarraynum[i + 1 + j] == 0:
                b += 1
        if b >= a:
            break
    
    if b < a:
        a = b


print(a)

Fixed submission:
N = int(input())
S = str(input())
Sarray = list(S)

white = 0 #にしなきゃ
black = 0 #にしなきゃ
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        black += 1

a = [white + black]
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        black -= 1
    else:
        white += 1
    a.append(white + black)
a.sort()
print(a[0])

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_c

N = int(input())
S = str(input())
Sarray = list(S)
Sarraynum = []

#白0
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        Sarraynum.append(0)
    else:
        Sarraynum.append(1)

a = 2 * len(Sarraynum)
for i in range(len(Sarraynum)):
    black2white = 0
    white2black = 0
    for j in range(i):
        black2white += Sarraynum[j]
        if black2white >= a:
            break

    for j in range(i + 1, len(Sarraynum)):
        if Sarraynum[j] == 0:
            white2black += 1
        if black2white + white2black >= a:
            break
    
    if black2white + white2black < a:
        a = black2white + white2black


print(a)

Fixed submission:
N = int(input())
S = str(input())
Sarray = list(S)

white = 0 #にしなきゃ
black = 0 #にしなきゃ
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        black += 1

a = [white + black]
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        black -= 1
    else:
        white += 1
    a.append(white + black)
a.sort()
print(a[0])

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_c

N = int(input())
S = str(input())
Sarray = list(S)
Sarraynum = []

#白0
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        Sarraynum.append(0)
    else:
        Sarraynum.append(1)

white2black = len(Sarraynum)
black2white = len(Sarraynum)
for i in range(len(Sarraynum)):
    black2whiteTMP = 0
    white2blackTMP = len(Sarraynum) - i - 1
    for j in range(i):
        black2whiteTMP += Sarraynum[j]
    for j in range(i + 1, len(Sarraynum)):
            white2blackTMP -= Sarraynum[j]
    if black2whiteTMP + white2blackTMP < white2black + black2white:
        white2black = white2blackTMP
        black2white = black2whiteTMP


print(white2black + black2white)

Fixed submission:
N = int(input())
S = str(input())
Sarray = list(S)

white = 0 #にしなきゃ
black = 0 #にしなきゃ
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        black += 1

a = [white + black]
for i in range(len(Sarray)):
    if Sarray[i] == '.':
        black -= 1
    else:
        white += 1
    a.append(white + black)
a.sort()
print(a[0])