N = int(input())

S = str(input())

cnt = 0
target = S[0]
for i in range(1, N):
    if target == '#' and S[i] == '.':
        cnt += 1
        target = '#'  # 黒に変える
        continue

    if S[i] == '#':
        target = '#'
    else:
        target = '.'

cnt_2 = 0
aim = S[-1]
for i in range(N-1, -1, -1):
    if aim == '.' and S[i] == '#':
        cnt_2 += 1
        aim = '.'
        continue

    if S[i] == '#':
        aim = '#'
    else:
        aim = '.'

black = 0
white = 0
for i in range(N):
    if S[i] == '#':
        black += 1
    else:
        white += 1

less_color = min(black, white)
if (black <= white) and S[-1] == '#':
    less_color -= 1

print(int(min(cnt, cnt_2, less_color)))
