n = gets.to_i
as = gets.split.map(&:to_i)

posc = as.count { |a| a >= 0 }
negc = as.count { |a| a <= 0 }

ans = []
if as.max.abs > as.min.abs
  as.sort!
  while as.count > 1 do
    x = as.shift
    y = as.shift
    if as.count == 0
      t = [x, y].min
      x = [x, y].max
      y = t
    end
    as << x - y
    ans << "#{x} #{y}"
  end
else
  as.sort!.reverse!
  while as.count > 1 do
    x = as.shift
    y = as.shift
    as.unshift(x - y)
    ans << "#{x} #{y}"
  end
end

puts as.first
puts ans