main = do
  nums <- map (read :: String -> Int) . words . tail <$> getContents
  let [min_, max_, sum_] = map show [foldl min 10001 nums, foldl max 0 nums, sum nums]
  putStrLn $ min_ ++ " " ++ max_ ++ " " ++ sum_