n=gets.chomp.to_i
answers = []

input_values = gets.chomp.split.map(&:to_i)
i = 0
(n-1).times do
  (n-1).times do |i|
    if input_values[i] > input_values[i+1]
      tmp = input_values[i+1]
      input_values[i+1] = input_values[i]
      input_values[i] = tmp
    end
  end
end

min = input_values[0]
max = input_values[-1]
sum = 0
i = 0
n.times do
  sum += input_values[i]
  i += 1
end
answers.push(min, max, sum)
puts answers.join(' ')