import Text.Printf

ft (a,b,c) =
  printf "%d %d %d\n" a b c

mms :: [Int] -> (Int, Int, Int)
mms x =
  (minimum x, maximum x, sum x)

main = do
  n <- getLine
  a <- getLine
  putStrLn $ ft $ mms $ map (read :: String -> Int) $ words a