n = int(input())
s = list(input())

b_sum = []
w_sum = []
b_num = 0
w_num = 0

#b_sum:i番目まで黒が何個か
#w_sum:i番目まで白が何個か

for i in range(n):
    if s[i] == "#":
        b_num = b_num + 1
    else:
        w_num = w_num + 1
    b_sum.append(b_num)
    w_sum.append(w_num)

#i番目まで白になるときは何個ひっくり返す？

ans = []

for i in range(n):
    ans.append(b_sum[i] + w_sum[n - 1] - w_sum[i])

print(min(ans))
