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] == ".":
        # print(i, ans, black, white)
        if ans == 0:
            black = S[:i + 1].count("#")
            white = S[i + 1:].count(".")
            ans += min(black, white)
            k = i
        elif ans >= 1:
            # print( S[k+1:i + 1])
            black2 = S[k+1:i + 1].count("#")
            white2 = S[k+1:i + 1].count(".")
            # print(black2,white2)
            ans += min(black2,white2)
            # black += black2
            # white -= white2
            k = i
        # print(i, ans, black, white)
print(ans)