import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Foldable
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
  n <- getInt
  s <- getLine

  let solve nB nW [] res = res + min nB nW
      solve nB nW (c:cs) res
        | c == '.' && nB > 0 = solve nB (nW+1) cs res
        | c == '.'           = solve nB nW cs res
        | c == '#' && nW > 0 = solve 1 0 cs (res + min nB nW)
        | c == '#'           = solve (nB+1) 0 cs res

  print $ solve 0 0 s 0