import Control.Monad

main :: IO ()
main = do
  readLn
  strlist <- readLn
  let list = map read $ words strList
  putStr $ maximum list
  putStr ' '
  putStr $ minimum list
  putStr ' '
  putStrLn $ sum list
