n = int(input())
s = list(input())
s += [0]

b = 0
w = 0
p = 0
for i in range(n):
    if s[i] == "#":
        b += 1
    if b > 0:
        if s[i] == ".":
            w += 1
            if s[i+1] == "#" or s[i+1] == 0:
                p += min(b,w)
                b = 0
                w = 0

print(p)