N = gets.to_i
A = gets.split.map(&:to_i).sort

if N == 2
  puts A.max - A.min
  puts [A.max, A.min].join(' ')
  exit
end

plus = []
minus = []
query = []

n = N - 1

if A.all? { |x| x >= 0 }
  plus = A
  pl = plus.shift
  mi = plus.pop
  minus << pl - mi
  query << [pl, mi]
  n -= 1
elsif A.all? { |x| x <= 0 }
  minus = A
  pl = minus.pop
  mi = minus.shift
  plus << (minus.pop - minus.shift)
  query << [pl, mi]
  n -= 1
else
  plus = A.select { |x| x >= 0 }
  minus = A.select { |x| x < 0 }
end

n.times do |i|
  pl = plus.pop
  mi = minus.pop

  if i == n - 1
    puts pl - mi
    query << [pl, mi]

    query.each do |x, y|
      puts [x, y].join(' ')
    end
  else
    if plus.size >= minus.size
      minus << mi - pl
      query << [mi, pl]
    else
      plus << pl - mi
      query << [pl, mi]
    end
  end
end
