let rec f l tup =
	match l with
	|[] -> tup
	|x::xs -> let (a,b,c) = tup in f xs ((if x < a then x else a),(if x > b then x else b),x+c);;

let rec map f l =
	match l with
	|[] -> []
	|x::xs -> (f x)::(map f xs);;

let num = Scanf.sscanf(read_line()) "%d" (fun x -> x)
in
let rec make l n =
	match n with
	|0 -> l
	|_ -> make ((Scanf.scanf " %d" (fun x -> x))::l) (n-1)
in
let (a,b,c) = f (make [] num) (100000000,-100000000,0)
in
Printf.printf "%d %d %d\n" a b c;;

