# TPBC201C - Stones
n = int(input())
s = list(input())
ans = 0
if len(set(s)) == 1:
    print(ans)
else:
    while s[0] == ".":
        s.pop(0)
    while s[-1] == "#":
        s.pop()
    lst = "".join(s).split(".#")
    for i in range(len(lst)):
        if i == 0:
            ans += min(lst[i].count("#"), lst[i].count(".") + 1)
        elif i == len(lst) - 1:
            ans += min(lst[i].count("#") + 1, lst[i].count("."))
        else:
            ans += min(lst[i].count("#") + 1, lst[i].count(".") + 1)
    print(ans)