let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let take n lst =
  let rec doit n lst acc =
    if n <= 0 then List.rev acc
    else
      match lst with
      | [] -> List.rev acc
      | hd :: tl -> doit (n - 1) tl (hd :: acc)
  in
  doit n lst []

let () =
  let n = read_int () in
  let l = read_line () in
  let an = take n (List.map int_of_string (split l ' ')) in
  let min = List.fold_left (fun acc ai -> min acc ai) 1000001 an in
  let max = List.fold_left (fun acc ai -> max acc ai) (-1000001) an in
  let sum = List.fold_left ( + ) 0 an in
  Printf.printf "%d %d %d\n" min max sum