N = int(input())
S = input()

sList = list(S)

leftInd = 0
rightInd = N - 1
ind = (leftInd + rightInd) // 2

def myFunc(ind):
    
    leftNum = sList[:ind].count("#")
    rightNum = sList[ind:].count(".")

    return leftNum, rightNum


if len(set(sList)) == 1:
    ans = 0
else:
    while True:
        ind = (leftInd + rightInd) // 2
        leftNum, rightNum = myFunc(ind)
        leftNum1, rightNum1 = myFunc(ind - 1)
        leftNum2, rightNum2 = myFunc(ind + 1)
        if abs(leftNum - rightNum) <= 1 or abs(leftNum1 - rightNum1) <= 1 or abs(leftNum2 - rightNum2) <= 1:
            ans = min(leftNum + rightNum, leftNum1 + rightNum1, leftNum2 + rightNum2)
            break
        elif leftNum > rightNum:
            rightInd = ind
        else:
            leftInd = ind

print(ans)