import Text.Printf
import Data.List

main = do
  s1 <- getLine
  s2 <- getLine
  let l = map (read :: String->Int) $ words s2
  putStr $ show $ minimum l
  ;putStr " "
  ;putStr $ show $ maximum l
  ;putStr " "
  ;putStrLn $ show $ sum l