import Data.List(findIndex)

main = do
    n <- readLn
    s <- getLine
    let cntB = length $ filter (=='#') s
    let cntW = n - cntB
    let resB = case findIndex (=='#') s of
                Nothing -> 0
                Just preW -> cntW - preW
    let resW = case findIndex (=='.') (reverse s) of
                Nothing -> 0
                Just sufB -> cntB - sufB
    print $ min resB resW