num = STDIN.gets.to_i
lines = STDIN.get.chomp.split.map{|v| v.to_i}

maxval=lines.slice(0..num-1).max
sum = 0
minval=lines.slice(0..num-1).min
lines.slice(0..num-1) do |elm|
sum = sum + elm
end

puts"#{minval} #{maxval} #{sum}"