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

stone = [[0, 0] for _ in range(N)]
before_w, before_b = 0, 0

for i in range(N):
    if S[i] == '.':
        stone[i] = [before_w+1, before_b]
        before_w += 1
    else:
        stone[i] = [before_w, before_b+1]
        before_b += 1

total_w, total_b = stone[-1]

#全ての石を黒に変える時
ans = S.count('.')

for i in range(N):
    w = stone[i][1]  # 左側にある黒を全てホワイトに
    tmp = total_w - stone[i][0]
    b = tmp if S[i]=='#' else tmp+1
    ans = min(ans, w+b)

print(ans)