import Control.Applicative
import Text.Printf

main = do
  x <- getLine
  xs <- map read . words <$> getLine
  putStrLn . toString . solve $ xs

solve :: [Int] -> (Int,Int,Int)
solve xs = (maximum xs, minimum xs, sum xs)

toString :: (Int,Int,Int) -> String
toString (x,y,z) = printf "%d %d %d" x y z