N = int(input())
S = list(input())
n_sharp = S.count("#")
n_period = S.count(".")
temp = [[], []]

for i in range(N - 1):
    if S[i] == "#" and S[i + 1] == ".":
        temp[0].append(S[:i + 1].count("#"))
        temp[1].append(S[i + 1:].count("."))
_ = len(temp[0])
ans = min(temp[0])
for i in range(_ -1):
    ans += min(abs(temp[0][i + 1] - temp[0][i]), abs(temp[1][i + 1] - temp[1][i]))
print(ans)