N = int(eval(input()))

S = eval(input())

dp = [[] for _ in range(N)]

white = black = 0

for i in range(N):

    if S[i] == '.':

        white += 1

    else:

        black += 1

    dp[i] = [white, black]

W = S.count('.')

B = N - W #黒石の数

answer = W

for i in range(N):

    # iの場所より左側を全て白、右側を黒にする

    change = dp[i][1] + (W - dp[i][0])

    if change < answer:

        answer = change

print(answer)
N = int(eval(input()))

S = eval(input())

white = black = 0

W = S.count('.')

B = N - W #黒石の数

answer = W

for i in range(N):

    if S[i] == '.':

        white += 1

    else:

        black += 1

    change = black + W - white

    if change < answer:

        answer = change

    

print(answer)
N = int(eval(input()))
S = eval(input())
dp = [[] for _ in range(N)]
white = black = 0
for i in range(N):
    if S[i] == ".":
        white += 1
    else:
        black += 1
    dp[i] = [white, black]
W = S.count(".")
B = N - W  # 黒石の数
answer = W
for i in range(N):
    # iの場所より左側を全て白、右側を黒にする
    change = dp[i][1] + (W - dp[i][0])
    if change < answer:
        answer = change
print(answer)

N = int(eval(input()))
S = eval(input())
white = black = 0
W = S.count(".")
B = N - W  # 黒石の数
answer = W
for i in range(N):
    if S[i] == ".":
        white += 1
    else:
        black += 1
    change = black + W - white
    if change < answer:
        answer = change
print(answer)

-dp = [[] for _ in range(N)] +W = S.count(".") +B = N - W  # 黒石の数 +answer = W -    dp[i] = [white, black] -W = S.count(".") -B = N - W  # 黒石の数 -answer = W -for i in range(N): -    # iの場所より左側を全て白、右側を黒にする -    change = dp[i][1] + (W - dp[i][0]) +    change = black + W - white