import Control.Applicative

main = do _ <- getLine
          as <- map read . words <$> getLine
          let aMax = maximum as
          let aMin = minimum as
          let aSum = sum as
          putStrLn $ (show aMin) ++ " " ++ (show aMax) ++ " " ++ (show aSum)