N = int(input())
S = input()

WHITE = '.'
BLACK = '#'

ans = 0
w_num = 0
b_num = 0
only_w = True
is_w = True
for v in S:
    if only_w:
        if v == BLACK:
            only_w = False
            is_w = False
            b_num += 1
    else:
        if is_w:
            if v == WHITE:
                w_num += 1
            else:
                is_w = False
                ans += min(w_num, b_num)
                w_num = 0
                b_num = 1
        else:
            if v == BLACK:
                b_num += 1
            else:
                is_w = True
                w_num += 1

if is_w:
    ans += min(w_num, b_num)

print(ans)
