n = int(eval(input()))

s = list(eval(input()))



rd = 0

for e in s:

    if e == ".":

        rd += 1



res = rd

for e in s:

    if e == ".":

        rd -= 1

    else:

        rd += 1

    res = min(res, rd)



print(res)

n = int(eval(input()))



minv = res = rd = 0

for e in eval(input()):

    if e == ".":

        res += 1

        rd -= 1

        minv = min(minv, rd)

    else:

        rd += 1



print((res + minv))

n = int(eval(input()))
s = list(eval(input()))
rd = 0
for e in s:
    if e == ".":
        rd += 1
res = rd
for e in s:
    if e == ".":
        rd -= 1
    else:
        rd += 1
    res = min(res, rd)
print(res)

n = int(eval(input()))
minv = res = rd = 0
for e in eval(input()):
    if e == ".":
        res += 1
        rd -= 1
        minv = min(minv, rd)
    else:
        rd += 1
print((res + minv))

-s = list(eval(input())) -rd = 0 -for e in s: +minv = res = rd = 0 +for e in eval(input()): -        rd += 1 -res = rd -for e in s: -    if e == ".": +        res += 1 +        minv = min(minv, rd) -    res = min(res, rd) -print(res) +print((res + minv))