N=int(input())
S = input()
left = -1
for i, s in enumerate(S):
    if s == '#':
        left = i
        break
now = ''
left2 = -1
for i, s in enumerate(S[::-1]):
    if s == '.' and now=='':
        now='.'
    elif s=='#' and now=='.':
        now = '#'
    elif s=='.' and now=='#':
        left2 = i
        break

left2 = len(S)-left2
left3 = 0
for i in range(left2, len(S)):
    if S[i]=='#':
        left3+=1
    else:
        break
left3 = left2+left3

ans = min(S[left:left2].count('.'), S[left:left2].count('#')) + min(left3-left2, len(S)-left3-len(S.split('.')[-1]))
if ans < 0:
    print(min(S.count('#'), S[left:].count('.')))
else:
    print(ans)