
count = gets.to_i
input = gets.chomp
input_arr = input.split(' ').map(&:to_i)

def sums(arr)
	sum = 0
	arr.each {|i|
		sum += i
	}
	return sum
end
puts sprintf('%d %d %d', input_arr.min, input_arr.max, sums(input_arr))