import Control.Applicative

max_func [x] = x
max_func (x:rest) = max x (max_func rest)

min_func [x] = x
min_func (x:rest) = min x (min_func rest)

main = do
  n <- readLn :: IO Int
  ss <- (map read . words) <$> getLine
  -- sum
  let sum = show $ foldl (+) 0 ss
  let min = show $ min_func ss
  let max = show $ max_func ss
  putStrLn $ min ++ " " ++ max ++ " " ++ sum