import Control.Applicative
import Text.Printf

main = do
  getLine
  arr <- map (\x -> read x :: Int) . words <$> getLine
  printf "%d %d %d\n" (foldl min 1000000 arr) (foldl max (-1000000) arr) (foldl (+) 0 arr)