n = int(input())
s = input()
black_appered = False
ans = 0
b_cnt = 0
w_cnt = 0
# [BBB...WWW...]の組を抽出する
for i in range(n):
    x = s[i]
    if x == '#': b_cnt +=1
    if x == '.': w_cnt +=1
    if i == n-1 or (x == '#' and 0 < w_cnt and 0 < b_cnt):
        ans += min(b_cnt, w_cnt)
        b_cnt,w_cnt = 0,0
    # print(b_cnt, w_cnt,ans)
print(ans)