n = int(input())
s = list(input())
s.append("#")

w_cnt = 0
b_cnt = 0
cnt = 0
isLeft = True
for i in range(len(s)-1):
    if isLeft:
        if s[i] == "#":
            b_cnt += 1
    else:
        if s[i] == ".":
            w_cnt += 1

    if not isLeft and s[i] == "." and s[i+1] == "#":
        cnt += min(b_cnt, w_cnt)
        w_cnt, b_cnt = 0, 0
        isLeft = True

    if s[i] == "#" and s[i+1] == ".":
        isLeft = False

print(cnt)

# .##...####... ->
# ......#######

