N = int(input())
S = input()

cnt_b = [0 for i in range(N)]    # i番目を含んでそれまでにb，wが何個あるか
cnt_w = [0 for i in range(N)]

if S[0] == "#":
    cnt_b[0] = 1
else:
    cnt_w[0] = 1

for i in range(N - 1):
    if S[i] == "#":
        cnt_b[i + 1] = cnt_b[i] + 1
    else:
        cnt_w[i + 1] = cnt_w[i] + 1

cnt_change = [0 for i in range(N)]
S = "s" + S
for i in range(N):
    cnt_change[i] = S[:i + 1].count("#") + S[i + 1:].count(".")

print(min(cnt_change))