n = int(input())
s = input()
# 矛盾点の前にある黒石の数と、後ろにある白石の数の小さい方＋１をカウント
ans = 0
black_cnt = 0
prev = ""
L = R = 0
while L < n:
    if prev+s[L] == "#.":
        white_cnt = 0
        while R < n-1:
            R += 1
            if s[R] != '.':
                break
            white_cnt += 1
        ans += min(black_cnt, white_cnt)+1
        L = R = R+1
        continue
    if s[L] == "#":
        black_cnt += 1
    else:
        black_cnt = 0
    prev = s[L]
    L += 1
    R += 1
print(ans)
