n = gets.to_i
max = ???1000000
min = 1000000
sum = 0
for i in 1..n
    x = gets.to_i
    if x > max
        max = x
    elsif x < min
        min = x
    end
    sum += x
end
printf("%d %d %d\n", min, max, sum)