n = int(eval(input()))

s = eval(input())

white = 0

black = 0

for i in range(n):

    if s[i] == ".":

        white += 1

ans = float("inf")

for j in range(n + 1):

    if white + black < ans:

        ans = white + black

    if j == n:

        break

    if s[j] == ".":

        white -= 1

    else:

        black += 1

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

s = eval(input())

white = 0

black = 0

for i in range(n):

    if s[i] == ".":

        white += 1

ans = white + black

for j in range(n):

    if s[j] == ".":

        white -= 1

    else:

        black += 1

    if white + black < ans:

        ans = white + black

print(ans)
n = int(eval(input()))
s = eval(input())
white = 0
black = 0
for i in range(n):
    if s[i] == ".":
        white += 1
ans = float("inf")
for j in range(n + 1):
    if white + black < ans:
        ans = white + black
    if j == n:
        break
    if s[j] == ".":
        white -= 1
    else:
        black += 1
print(ans)

n = int(eval(input()))
s = eval(input())
white = 0
black = 0
for i in range(n):
    if s[i] == ".":
        white += 1
ans = white + black
for j in range(n):
    if s[j] == ".":
        white -= 1
    else:
        black += 1
    if white + black < ans:
        ans = white + black
print(ans)

-ans = float("inf") -for j in range(n + 1): -    if white + black < ans: -        ans = white + black -    if j == n: -        break +ans = white + black +for j in range(n): +    if white + black < ans: +        ans = white + black