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

ans = [0,0]
cnt = 0
judge_b = 0
judge_w = 0
for i in range(n):
    if s[i] == "#" and judge_b == 1 and ans[1] != 0:
        cnt += min(ans)
        ans[0] = 1
        ans[1] = 0
        judge_b = 0
        judge_w = 0
    elif s[i] == "#":
        ans[0] += 1
        judge_b = 1
    elif s[i] == "." and judge_w == 1 and ans[0] != 0:
        cnt += min(ans)
        ans[0] = 0
        ans[1] = 1
        judge_b = 0
        judge_w = 0
    elif s[i] == ".":
        ans[1] += 1
    if i == n-1 and ans[1] != 0 and s[i] == ".":
        cnt += min(ans)
print(cnt)