import Data.List (sort)
main = do
  numStr <- getLine
  listStr <- getLine
  let num = read numStr :: Int
      list = sort . map read . words $ listStr :: [Int]
      min = head list
      max = last list
      sumList = sum list
  putStrLn $ show min ++ " " ++ show max ++ " " ++ show sumList