N = int(input())
S = list(input())
n_sharp = S.count("#")
n_period = S.count(".")
temp = [[], []]
k = 0
for i in range(N - 1):
    if S[i] == "#" and S[i + 1] == ".":
        temp[0].append(S[:i + 1].count("#"))
        # print(S[:i + 1], S[i + 1:])
        temp[1].append(S[i + 1:].count("."))
        k += 1
        if k == 1:
            ans = min(temp[0], temp[1])[0]
            # print((ans))
        elif k > 1:
            ans += min(abs(temp[0][k-1] - temp[0][k - 2]), abs(temp[1][k-1] - temp[1][k - 2]))

print(ans)