class Main
  n = gets.to_i
  str = gets.split(" ").to_i
  min = str[0]
  max = str[0]
  index = 1
  while count == n
    min = str[index + 1] if str[index + 1] < str[index]
    max = str[index + 1] if str[index + 1] > str[index]
    sum += str[index]
    index += 1
  end
  puts "#{min} #{max} #{sum}"
end
