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

WHITE = '.'
BLACK = '#'

ans = 0
w_to_b = [0]
for i in range(1, N):
    if S[i-1] == WHITE and S[i] == BLACK:
        w_to_b.append(i)

p_num = len(w_to_b)
for i in range(p_num):
    start = w_to_b[i]
    if i == p_num - 1:
        w_num = S[start:].count(WHITE)
        b_num = S[start:].count(BLACK)
    else:
        end = w_to_b[i+1]
        w_num = S[start:end].count(WHITE)
        b_num = S[start:end].count(BLACK)
    ans += min(w_num, b_num)

print(ans)
