N = int(input())
S = input()

A = S.split('#')
B = S.split(".")

C = []
D = []
for i in A:
    C.append(len(i))
for i in B:
    D.append(len(i))

C = [i for i in C if not i == 0]
D = [i for i in D if not i == 0]

E = [0]
F = [0]
for i in C:
    E.append(i + E[-1])
for i in D:
    F.append(i + F[-1])



if len(E) > len(F):
    F.insert(0,0)
if len(F) > len(E):
    E.insert(0,0)

E = E[::-1]


ans = 10 ** 9
for i in range(len(E)):
    score = E[i] + F[i]
    if score < ans:
        ans = score

print(ans)