N = int(input())
S = list(input())
black = 0
white = 0
black2 = 0
white2 = 0
k = 0
ans = 0
for i in range(N - 1):
    if S[i] == "#" and S[i + 1] == ".":
        if k == 0:
            black = S[:i + 1].count("#")
            white = S[i + 1:].count(".")
            ans += min(black, white)
            k = 1
        elif k == 1:
            black2 = S[:i + 1].count("#")
            white2 = S[i + 1:].count(".")
            ans += min(black2 - black, white - white2)
            black = black2
            white = white2
print(ans)