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

count_blk = []
count_wht = []

ct_blk = 0
ct_wht = 0
for i in S:
    if i == '#':
        ct_blk += 1
    else:
        ct_wht += 1
    count_blk.append(ct_blk)
    count_wht.append(ct_wht)

ans = 10**6
for i in range(N):
    ans = min(ans, count_blk[i] + ct_wht - count_wht[i])

print(ans)
