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

ans = 0
cnt_black = 0
cnt_white = 0
for idx in range(n):
    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] == '#.':
            ans += min(cnt_black, cnt_white)
            cnt_black = 0
            cnt_white = 1

print(ans)