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

#違反している黒と白の数数えて
#少ない方で置き換える

answer = 0

#まず一番左の黒のいちを見つける
left_black = -1
right_white = -1

for i in range(N):
    if S[i]=='#':
        if S.count('#')==N-i:
            break
        left_black = i
        break

for i in reversed(range(N)):
    if S[i]=='.':
        right_white = i
        break

# print(right_white)



# print(left_black)
#left_blackが-1かN-1なら自動的に0


if left_black!=-1 and left_black!=N-1:
    white_disc = S[left_black:right_white+1].count('.')
    black_disc = S[left_black:right_white+1].count('#')
    if(white_disc<black_disc):
        answer = white_disc
    else:
        answer = black_disc

print(answer)



