let split_int str =
  let rec split_inner ct b=
    if String.length str = ct then [int_of_string b]
    else
      match str.[ct] with
        ' ' -> (int_of_string b)::split_inner (ct+1) ""
      | c -> split_inner (ct+1) (b^(Char.escaped c))
  in split_inner 0 "";;

let () =
  let _n = read_line ()
  and s = read_line () in
  let l = split_int s in
  let (min, max, sum) =
    List.fold_left (fun (x1,x2,x3) y-> ((min x1 y),(max x2 y),(x3+y))) (1000000,-1000000,0) l in
  Printf.printf "%d %d %d\n" min max sum;;