import Control.Applicative

main :: IO()
main = do
  _ <- getLine
  input <- map (read :: String -> Int) . words <$> getLine
  putStrLn $ show (minimum input) ++ " " ++
             show (maximum input) ++ " " ++ show (sum input)