import Control.Applicative
import Numeric

lmax [x] = x
lmax (x:xs) = 
    if x>m then x else m
    where m = lmax xs

lmin [x] = x
lmin (x:xs) = 
    if x<m then x else m
    where m = lmin xs

main = do
    _ <- getLine 
    ss <- words <$>getLine
    let a = [read x| x<- ss] ::[Int]
    putStrLn $ show(lmin a) ++ " " ++ show(lmax a) ++ " " ++ show(sum a)