n = int(input())
s = input()+"#"

cnt_w = 0
cnt_b = 0
cnt = 0
status = 0
for i in range(n+1):
    if status == 0:
        if s[i] == "#":
            cnt_b = 1
            status = 1
    elif status == 1:
        if s[i] == ".":
            cnt_w += 1
            status = 2
        else:
            cnt_b += 1
    elif status == 2:
        if s[i] == ".":
            cnt_w += 1
        else:
            cnt += min(cnt_b, cnt_w)
            cnt_b = 1
            cnt_w = 0
            status = 1

print(cnt)