N = int(eval(input()))

S = eval(input())



b = [0] * (N+1)

w = [0] * (N+1)



for i, s in enumerate(S):

    b[i+1] = b[i]

    w[i+1] = w[i]

    if s == "#":

        b[i+1] += 1

    if s == ".":

        w[i+1] += 1



ans = float('inf')



for i in range(N+1):

    ans = min(ans, b[i] + w[N] - w[i])



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

S = eval(input())



w_N = S.count(".")

ans = w_N

b = 0

w = 0



for i, s in enumerate(S):

    if s == "#":

        b += 1

    if s == ".":

        w += 1

    ans = min(ans,b + w_N - w)



print(ans)
N = int(eval(input()))
S = eval(input())
b = [0] * (N + 1)
w = [0] * (N + 1)
for i, s in enumerate(S):
    b[i + 1] = b[i]
    w[i + 1] = w[i]
    if s == "#":
        b[i + 1] += 1
    if s == ".":
        w[i + 1] += 1
ans = float("inf")
for i in range(N + 1):
    ans = min(ans, b[i] + w[N] - w[i])
print(ans)

N = int(eval(input()))
S = eval(input())
w_N = S.count(".")
ans = w_N
b = 0
w = 0
for i, s in enumerate(S):
    if s == "#":
        b += 1
    if s == ".":
        w += 1
    ans = min(ans, b + w_N - w)
print(ans)

-b = [0] * (N + 1) -w = [0] * (N + 1) +w_N = S.count(".") +ans = w_N +b = 0 +w = 0 -    b[i + 1] = b[i] -    w[i + 1] = w[i] -        b[i + 1] += 1 +        b += 1 -        w[i + 1] += 1 -ans = float("inf") -for i in range(N + 1): -    ans = min(ans, b[i] + w[N] - w[i]) +        w += 1 +    ans = min(ans, b + w_N - w)