# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i).sort

# -2 -1 0 3 5 8
x = a.shift
y = 0
l = []
while a.size > 1
  y = a.pop
  l.push "#{x} #{y}"
  x = x - y
end
y = a.pop
l.push "#{y} #{x}"
puts y - x
puts l
