MODE = "stdio"

line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = "\
  5
  10 1 5 4 17
  ".split("\n")
  tmp.each{|s|
    line << s.strip
  }
end

r=Array.new
r = line[1].split(" ").map(&:to_i)

printf("%d %d %d\n",r.min,r.max,r.inject(:+))