main :: IO ()                                                                                                                                         
main = do                                                                                                                                             
  _ <- getLine                                                                                                                                        
  s <- reverse . dropWhile (=='#') . reverse . dropWhile (=='.') <$> getLine                                                                          
  let w = length . filter (=='.') $ s                                                                                                                 
  print $ minimum $ map (uncurry (+)) $ solve 0 w s                                                                                                   
--  print $ solve 0 w s                                                                                                                               
                                                                                                                                                      
solve :: Int -> Int -> String -> [(Int,Int)]                                                                                                          
solve a b [] = [(a,b)]                                                                                                                                
solve a b [x]                                                                                                                                         
  | x == '.' = [(a,b-1)]                                                                                                                              
  | x == '#' = [(a+1,b)]                                                                                                                              
solve a b (x:y:xs)                                                                                                                                    
  -- | x == '.' = solve a (b-1) (y:xs)                                                                                                                
  -- | x == '#' && y == '#' = solve (a+1) b (y:xs)                                                                                                    
  -- | x == '#' && y == '.' = (a,b) : solve (a+1) b (y:xs)                                                                                            
  | x == '#' = solve (a+1) b (y:xs)                                                                                                                   
  | x == '.' && y == '.' = solve a (b-1) (y:xs)                                                                                                       
  | x == '.' && y == '#' = (a,b-1) : solve a (b-1) (y:xs)