import qualified Data.ByteString.Char8 as BS

main = do
  n <- readLn
  s <- BS.getLine
  let initW = BS.length $ BS.takeWhile (== '.') s
      tailB = BS.length $ snd $ BS.spanEnd (== '#') s
      blacks = BS.count '#' s
      whites = n - blacks
  print $ min (n - blacks - initW) (n - whites - tailB)
