import Data.List.Split

main = do 
    n <- readLn :: IO Int
    s <- getLine
    let ts = reverse $ dropWhile (\x-> x == '#') $ reverse $ dropWhile (\x-> x == '.') s
    let spS = filter (/="") $ mySplit ts '.' [""]
    --print $ spS
    -- print $ filter (/="") $ mySplit ts '.' [""]
    let res = map (\x-> cnt x (0,0)) spS
    print $ sum $ map (\x->min (fst x) (snd x)) res

cnt :: String -> (Int,Int) -> (Int, Int)
cnt [] (b,w) = (b,w)
cnt (x:xs) (b,w) = if x == '#' then cnt xs (b+1,w) else cnt xs(b,w+1)

mySplit :: String -> Char -> [String] -> [String]
mySplit [] prev ys = ys
mySplit (x:xs) prev (y:ys) = if x == '#' && prev == '#' then mySplit xs x (('#':y):ys) else if x == '#' && prev /= '#' then mySplit xs x ("#":y:ys) else mySplit xs x (('.':y):ys)