n = int(input())
s = input()

b, w, v, f, g, ans = 0, 0, 0, 0, 0, 0
for i in range(n):
    if f and g and s[i] == "#":
        ans += min(b, w)
        b, w, v, f, g = 1, 0, 0, 0, 0
    elif s[i] == "#":
        b += 1
        f = 1
    elif f:
        w += 1
        g = 1
    else:
        v += 1
        
ans += min(b, v)
print(ans)