n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
res = Array.new(n-1).map{Array.new(2, 0)}
pre = a[0]
for i in 0..(n-3)
  if i == 0
    res[i][0] = a[i]
  else
    res[i][0] = pre
  end
  res[i][1] = a[i+1]
  pre = res[i][0] - res[i][1]
end
res[n-2][0] = a[n-1]
res[n-2][1] = pre

puts res[n-2][0] - res[n-2][1]
for i in 0..(n-2)
  puts "#{res[i][0]} #{res[i][1]}"
end