n = int(input())
s = input()
sl = []
count = 0
state = 0
b = 0
w = 0
for i in range(n):
    if s[i] == "#":
        if state == 0:
            state = 1
            b += 1
        elif state == 1:
            b += 1
        elif state == 2:
            if b > w:
                count += w
                b = 1 + b + w
                w = 0
                state = 1
            else:
                count += b
                b = 1
                w = 0
                state = 1
    else:
        if state == 1:
            state = 2
            w += 1
        elif state == 2:
            w += 1

if state == 2:
    count += min([b,w])

print(count)
