n = int(input())
stone = input()
ans = 0
blackCnt = 0
whiteCnt = 0
sw = False
for i in range(n):
    if blackCnt > 0 and whiteCnt > 0 and stone[i] == '#':
        if blackCnt > whiteCnt:
            ans = whiteCnt
        else:
            ans = blackCnt
        blackCnt = 1
        whiteCnt = 0

    elif stone[i] == '#':
        sw = True
        blackCnt += 1
    elif stone[i] == '.' and sw == True:
        whiteCnt += 1

if blackCnt > 0 and whiteCnt > 0:
    if blackCnt > whiteCnt:
        ans += whiteCnt
    else:
        ans += blackCnt

print(ans)