n = int(input())
s = input()
count = 0
state = 0
b = 0
w = 0
sh = 0
for i in range(n):
    if s[i] == "#":
        sh += 1
        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
                if count >= sh:
                    count = sh
                    sh = 1
                    b = 1
            else:
                count += b
                b = 1
                w = 0
                sh = 1
                state = 1
    else:
        if state == 1:
            state = 2
            w += 1
        elif state == 2:
            w += 1

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

print(count)
