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

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