let words str =
  let len = String.length str in
  let buf = Buffer.create 8 in
  let rec aux i l =
    if i >= len then List.rev (Buffer.contents buf :: l)
    else 
      match str.[i] with
      | ' ' ->
        let s = Buffer.contents buf in
        Buffer.clear buf;
        aux (i+1) (s :: l)
      | c   ->
        Buffer.add_char buf c;
        aux (i+1) l
  in
  aux 0 []
    
let () =
  let _ = read_int () in
  let nums  = List.map int_of_string (words (read_line ())) in
  let mi = List.fold_left (fun acc n -> min acc n) max_int nums in
  let ma = List.fold_left (fun acc n -> max acc n) min_int nums in
  let sum = List.fold_left (fun acc n -> acc + n) 0 nums in
  print_endline (Printf.sprintf "%d %d %d" mi ma sum)