main = do
  _ <- getLine
  getLine >>= putStrLn . solve . input

-- 入力
input :: String -> [Int]
input = (map read) . words

-- 解答
solve xs = unwords . map show $ [foldr min infty xs, foldr max (-infty) xs, foldr (+) 0 xs]
  where infty = 1000001

