import Control.Monad

main :: IO ()
main = do
  readLn
  strlist <- readLn
  let list = map read $ words strlist :: [Int]
  putStr ( show ( maximum list))
  putStr " "
  putStr ( show ( minimum list))
  putStr " "
  putStrLn ( show ( sum list))
