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

#.#






tmp = 0
ans2 = 0

for s in S:
    if s == "#":
        tmp += 1
    else:
        ans2 += tmp
        tmp = 0

S = S[::-1]

tmp = 0
ans1 = 0

for s in S:
    if s == ".":
        tmp += 1
    else:
        ans1 += tmp
        tmp = 0


print (min(ans1,ans2))
