import sys

n = int(sys.stdin.readline())

colo = list(map(int, input().split()))

# summa = sum(colo)
# seredne = summa // 3

# if seredne * 3 != colo:
#     first_step = [seredne, seredne, (summa - (seredne*2))]
# else:
#     first_step = [seredne, seredne, seredne]

# def second_step():
#     lenght = len(colo)
#     for i in range(lenght):
#         current_position = i
#         summ = 0
#         for j in range(lenght):
#             summ = i + current_position
#             if summ in first_step:
#                 b = 0
#                 for a in range(j - i):
#                     index = i+a
#                     if index > lenght:
#                         index = b
#                         b += 1
#                     print(index)
#                     colo.pop(index)
#                 return[i]
#             current_position += 1
#             if current_position > lenght:
#                 current_position = 0
            
# print(second_step())

print(max(colo[0], colo[1], colo[2]) - min(colo[0], colo[1], colo[2]))
print(colo[0], colo[1], colo[2])

# for i in range(3):
#     find_group()
# for i in range(len(answer)):
#     result_numbers += str(answer[i])
#     if i < 2:
#         result_numbers += " "
# print(result_numbers)