N = int(eval(input()))

S = eval(input())

t = S.count(".")

if t == N or t == 0:

    print((0))

    exit(0)



W = [0 for k in range(N+1)]

B = [0 for k in range(N+1)]



for k in range(N):

    if S[k] == "#":

        B[k] = B[k-1] + 1

    else:

        B[k] = B[k-1]



W[0] = t

for k in range(N):

    if S[k] == ".":

        W[k+1] = W[k] - 1

    else:

        W[k+1] = W[k]

ans = N

for k in range(N):

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

print((min(ans,t,S.count("#"))))
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())
t = S.count(".")
if t == N or t == 0:
    print((0))
    exit(0)
W = [0 for k in range(N + 1)]
B = [0 for k in range(N + 1)]
for k in range(N):
    if S[k] == "#":
        B[k] = B[k - 1] + 1
    else:
        B[k] = B[k - 1]
W[0] = t
for k in range(N):
    if S[k] == ".":
        W[k + 1] = W[k] - 1
    else:
        W[k + 1] = W[k]
ans = N
for k in range(N):
    ans = min(ans, W[k + 1] + B[k])
print((min(ans, t, S.count("#"))))

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()) -t = S.count(".") -if t == N or t == 0: -    print((0)) -    exit(0) -W = [0 for k in range(N + 1)] -B = [0 for k in range(N + 1)] -for k in range(N): -    if S[k] == "#": -        B[k] = B[k - 1] + 1 -    else: -        B[k] = B[k - 1] -W[0] = t -for k in range(N): -    if S[k] == ".": -        W[k + 1] = W[k] - 1 -    else: -        W[k + 1] = W[k] -ans = N -for k in range(N): -    ans = min(ans, W[k + 1] + B[k]) -print((min(ans, t, S.count("#")))) +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)