main = do
  n'<-getLine
  let n = read n' :: Int
  v'<-getLine
  let v = (map (read :: String->Int) . words) v'
  (putStrLn . unwords . map show . calc2) v

calc2 :: [Int] -> [Int]
calc2 v = [foldr1 min  v, foldr1 max  v, foldr1 (+) v]