# N = int(input())
#
# S = str(input())
#
# cnt = 0
# for i in range(1, N):
#     if S[i-1] == '#' and S[i] == '.':
#         cnt += 1
#
# cnt_2 = 0
# for i in range(N-2, -1, -1):
#     if S[i+1] == '.' and S[i] == '#':
#         cnt_2 += 1
#
#
# print(int(min(cnt, cnt_2)))

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-2, -1, -1):
    if aim == '.' and S[i] == '#':
        cnt_2 += 1
        aim = '.'
        continue

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


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