n = int(eval(input()))

s = eval(input())



b = [0 for k in range(n+1)]

c = 0

for k in range(n):

    if s[k] == "#":

        c += 1

    b[k+1] = c



w = [0 for k in range(n+1)]

c = 0

for k in range(n):

    if s[-k-1] == ".":

        c += 1

    w[-k-2] = c



ans = 10**9

for k in range(n+1):

    ans = min(ans,b[k]+w[k])



print(ans)

N = int(eval(input()))

S = "." + eval(input()) + "#"

B = [0]*(N+2)

W = [0]*(N+2)

b = 0

for k in range(N+2):

    if S[k] == "#":

        b += 1

    B[k] = b

w = 0

for k in range(N+1,-1,-1):

    if S[k] == ".":

        w += 1

    W[k] = w

ans = 10**10

for k in range(N+1):

    ans = min(ans,B[k]+W[k+1])

print(ans)

n = int(eval(input()))
s = eval(input())
b = [0 for k in range(n + 1)]
c = 0
for k in range(n):
    if s[k] == "#":
        c += 1
    b[k + 1] = c
w = [0 for k in range(n + 1)]
c = 0
for k in range(n):
    if s[-k - 1] == ".":
        c += 1
    w[-k - 2] = c
ans = 10**9
for k in range(n + 1):
    ans = min(ans, b[k] + w[k])
print(ans)

N = int(eval(input()))
S = "." + eval(input()) + "#"
B = [0] * (N + 2)
W = [0] * (N + 2)
b = 0
for k in range(N + 2):
    if S[k] == "#":
        b += 1
    B[k] = b
w = 0
for k in range(N + 1, -1, -1):
    if S[k] == ".":
        w += 1
    W[k] = w
ans = 10**10
for k in range(N + 1):
    ans = min(ans, B[k] + W[k + 1])
print(ans)

-n = int(eval(input())) -s = eval(input()) -b = [0 for k in range(n + 1)] -c = 0 -for k in range(n): -    if s[k] == "#": -        c += 1 -    b[k + 1] = c -w = [0 for k in range(n + 1)] -c = 0 -for k in range(n): -    if s[-k - 1] == ".": -        c += 1 -    w[-k - 2] = c -ans = 10**9 -for k in range(n + 1): -    ans = min(ans, b[k] + w[k]) +N = int(eval(input())) +S = "." + eval(input()) + "#" +B = [0] * (N + 2) +W = [0] * (N + 2) +b = 0 +for k in range(N + 2): +    if S[k] == "#": +        b += 1 +    B[k] = b +w = 0 +for k in range(N + 1, -1, -1): +    if S[k] == ".": +        w += 1 +    W[k] = w +ans = 10**10 +for k in range(N + 1): +    ans = min(ans, B[k] + W[k + 1])