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

ans = 0
has_black = False
has_white = False
cnt_black = 0
cnt_white = 0
for c in s:
    if c == '#':
        if has_black and has_white:
            has_black = False
            ans += min(cnt_white, cnt_black)
            cnt_white = 0
            cnt_black = 0
        else:
            has_black = True
            cnt_black += 1
    elif c == '.' and has_black:
        has_white = True
        cnt_white += 1

if c == '.':
    ans += min(cnt_black, cnt_white)

print(ans)