n = int(input())
stone = input()

blackCnt = 0
whiteCnt = 0

for i in range(n):
    if stone[i] == '#':
        blackCnt += 1
    elif stone[i] == '.' and blackCnt > 0:
        whiteCnt += 1

if blackCnt > 0 and whiteCnt > 0:
    if blackCnt > whiteCnt:
        print(whiteCnt)
    else:
        print(blackCnt)
else:
    print(0)