N = int(input())
S = input()
cnt_b = 0
cnt_w = 0
Is_Black = False
ans = 0

# ans = S.count("#.")
# print(ans)

for i in range(N):
    if S[i] == "#":
        if Is_Black:
            if cnt_w == 0:
                cnt_b += 1
            elif cnt_b != 0 and cnt_w != 0:
                ans += min(cnt_b, cnt_w)
                cnt_b = 1
                cnt_w = 0
        else:
            Is_Black = True
            cnt_b += 1
    else:
        if Is_Black and cnt_b!=0:
            cnt_w += 1
else:
    if cnt_b != 0 and cnt_w != 0:
                ans += min(cnt_b, cnt_w)
                cnt_b = 1
                cnt_w = 0

print(ans)