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