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

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

ans = []
if n == posc
  as.sort!
  while as.count > 1 do
    x = as.shift
    y = as.shift
    as << x-y
    ans << "#{x} #{y}"
  end
elsif n == negc
  as.sort!.reverse!
  while as.count > 1 do
    x = as.shift
    y = as.shift
    as.unshift(x-y)
    ans << "#{x} #{y}"
  end
else
  if as.max.abs > as.min.abs
    as.sort!
    while as.count > 1 do
      x = as.shift
      y = as.shift
      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
end
puts as.first
puts ans