input()
S = input()


if '#' in S:
    sharp = 0
    for c in S[::-1]:
        if c == '#':
            sharp += 1
        else:
            break
    black = S.index('#')
    print(min(S[black:].count('#') - sharp, S[black:].count('.')))
else:
    print(0)
