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

ans = 0
cnt_black = 0
cnt_white = 0
sakaime = False
for idx in range(n):
    if not sakaime:
        if s[idx] == '#':
            cnt_black += 1
            if cnt_white >= 1:
                cnt_white = 0
        elif s[idx] == '.':
            cnt_white += 1

        if idx >= 1:
            # print(s[idx-1:idx+1], ans)
            if s[idx-1:idx+1] == '#.':
                sakaime = True

    else:
        if s[idx] == '.':
            cnt_white += 1
        elif s[idx] == '#':
            ans += min(cnt_black, cnt_white)
            cnt_black = 1
            cnt_white = 0
            sakaime = False

if s[-1] == '.':
    ans += min(cnt_black, cnt_white)

print(ans)