import Control.Applicative
import Control.Monad

rInt s = read s :: Int

main  = do
	[n, as] <- (map (map rInt) . map words . lines) <$> getContents
	putStrLn $ unwords $ map show [foldl1 min as, foldl1 max as, sum as]