n=int(input())
s = input()
l = 0
r = 0
ans = 0
f = 1
for i in range(n):
    if i != 0 and s[i - 1] == "." and s[i] == "#":
        ans += min(l,r)
    if s[i] == "#":
        l += 1
        r = 0
    else:
        r += 1
    if i == n - 1 and s[i] == ".":
        ans += min(l, r)
print(ans)