import itertools
n = int(input())
s = [i for i in input()]
if s[0] == ".":
    for i in range(n):
        if s[i] == "#":
            s = s[i:]
            break
    if len(s) == n:
        print(0)
        exit()
gr = itertools.groupby(s)
ans = 0
cnt_s = 0
for k, g in gr:
    if k == "#":
        cnt_s = len(list(g))
    elif k == ".":
        ans += min(cnt_s, len(list(g)))
print(ans)