N=int(eval(input()))

S=eval(input())

b=0

w=S.count(".")

ans=b+w

for s in S:

    if s=="#":

        b+=1

    else:

        w-=1

    ans=min(ans, b+w)

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

s = eval(input())

counter = 0

counter = s.count('.')

result = counter

for i in s:

    if i == '#':

        counter += 1

    else:

        counter -= 1

    result = min(result, counter)

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

n = int(eval(input()))
s = eval(input())
counter = 0
counter = s.count(".")
result = counter
for i in s:
    if i == "#":
        counter += 1
    else:
        counter -= 1
    result = min(result, counter)
print(result)

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