input_line = []

while line = gets
  input_line << line.chomp
end

n = input_line.shift.to_i
s = input_line.shift.chomp.split(" ")
list = []
n.times do |i|
  list << s[i].to_i
end

puts "#{list.min} #{list.max} #{list.inject(:+)}"