import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    if len(A) == 2 and 0 in A:
        print(max(A) - 0)
        print(max(A), 0)
        exit()

    plus = deque(sorted([a for a in A if a >= 0]))
    minus = deque(sorted([a for a in A if a < 0]))

    res = []
    if plus and minus:
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)
    elif plus:
        x = plus.popleft()
        y = plus.pop()
        res.append([x, y])
        minus.append(x - y)
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        x = plus.pop()
        y = minus.pop()
        res.append([x, y])
        plus.append(x - y)
    else:
        x = minus.pop()
        y = minus.popleft()
        res.append([x, y])
        plus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)

    print(*plus)
    for i in res:
        print(*i)


if __name__ == '__main__':
    resolve() import sys sys from collections import deque sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline f_inf = float('inf') f_inf float('inf') float 'inf' mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    if len(A) == 2 and 0 in A:
        print(max(A) - 0)
        print(max(A), 0)
        exit()

    plus = deque(sorted([a for a in A if a >= 0]))
    minus = deque(sorted([a for a in A if a < 0]))

    res = []
    if plus and minus:
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)
    elif plus:
        x = plus.popleft()
        y = plus.pop()
        res.append([x, y])
        minus.append(x - y)
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        x = plus.pop()
        y = minus.pop()
        res.append([x, y])
        plus.append(x - y)
    else:
        x = minus.pop()
        y = minus.popleft()
        res.append([x, y])
        plus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)

    print(*plus)
    for i in res:
        print(*i) resolve n = int(input()) n int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split if len(A) == 2 and 0 in A:
        print(max(A) - 0)
        print(max(A), 0)
        exit()

     len(A) == 2 and 0 in A len(A) == 2 len(A) len A 2 0 in A 0 A print(max(A) - 0) print max(A) - 0 max(A) max A 0 print(max(A), 0) print max(A) max A 0 exit() exit a for a in A if a >= 0 for a in A if a >= 0 a A a >= 0 a 0 if a >= 0 a plus = deque(sorted([a for a in A if a >= 0])) plus deque(sorted([a for a in A if a >= 0])) deque sorted([a for a in A if a >= 0]) sorted [a for a in A if a >= 0] a for a in A if a < 0 for a in A if a < 0 a A a < 0 a 0 if a < 0 a minus = deque(sorted([a for a in A if a < 0])) minus deque(sorted([a for a in A if a < 0])) deque sorted([a for a in A if a < 0]) sorted [a for a in A if a < 0] res = [] res [] if plus and minus:
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)
    elif plus:
        x = plus.popleft()
        y = plus.pop()
        res.append([x, y])
        minus.append(x - y)
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        x = plus.pop()
        y = minus.pop()
        res.append([x, y])
        plus.append(x - y)
    else:
        x = minus.pop()
        y = minus.popleft()
        res.append([x, y])
        plus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)

     plus and minus plus minus while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
         len(plus) > 1 len(plus) len plus 1 x = minus.pop() x minus.pop() minus.pop minus pop y = plus.pop() y plus.pop() plus.pop plus pop res.append([x, y]) res.append res append [x, y] x y minus.append(x - y) minus.append minus append x - y x y while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)
     minus x = plus.pop() x plus.pop() plus.pop plus pop y = minus.pop() y minus.pop() minus.pop minus pop res.append([x, y]) res.append res append [x, y] x y plus.append(x - y) plus.append plus append x - y x y elif plus:
        x = plus.popleft()
        y = plus.pop()
        res.append([x, y])
        minus.append(x - y)
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        x = plus.pop()
        y = minus.pop()
        res.append([x, y])
        plus.append(x - y)
     plus x = plus.popleft() x plus.popleft() plus.popleft plus popleft y = plus.pop() y plus.pop() plus.pop plus pop res.append([x, y]) res.append res append [x, y] x y minus.append(x - y) minus.append minus append x - y x y while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
         len(plus) > 1 len(plus) len plus 1 x = minus.pop() x minus.pop() minus.pop minus pop y = plus.pop() y plus.pop() plus.pop plus pop res.append([x, y]) res.append res append [x, y] x y minus.append(x - y) minus.append minus append x - y x y x = plus.pop() x plus.pop() plus.pop plus pop y = minus.pop() y minus.pop() minus.pop minus pop res.append([x, y]) res.append res append [x, y] x y plus.append(x - y) plus.append plus append x - y x y x = minus.pop() x minus.pop() minus.pop minus pop y = minus.popleft() y minus.popleft() minus.popleft minus popleft res.append([x, y]) res.append res append [x, y] x y plus.append(x - y) plus.append plus append x - y x y while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)

     minus x = plus.pop() x plus.pop() plus.pop plus pop y = minus.pop() y minus.pop() minus.pop minus pop res.append([x, y]) res.append res append [x, y] x y plus.append(x - y) plus.append plus append x - y x y print(*plus) print *plus plus for i in res:
        print(*i) i res print(*i) print *i i if __name__ == '__main__':
    resolve() __name__ == '__main__' __name__ '__main__' resolve() resolve f_inf = float('inf') float('inf') f_inf mod = 10 ** 9 + 7 10 ** 9 + 7 mod def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    if len(A) == 2 and 0 in A:
        print(max(A) - 0)
        print(max(A), 0)
        exit()

    plus = deque(sorted([a for a in A if a >= 0]))
    minus = deque(sorted([a for a in A if a < 0]))

    res = []
    if plus and minus:
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)
    elif plus:
        x = plus.popleft()
        y = plus.pop()
        res.append([x, y])
        minus.append(x - y)
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        x = plus.pop()
        y = minus.pop()
        res.append([x, y])
        plus.append(x - y)
    else:
        x = minus.pop()
        y = minus.popleft()
        res.append([x, y])
        plus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)

    print(*plus)
    for i in res:
        print(*i) def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    if len(A) == 2 and 0 in A:
        print(max(A) - 0)
        print(max(A), 0)
        exit()

    plus = deque(sorted([a for a in A if a >= 0]))
    minus = deque(sorted([a for a in A if a < 0]))

    res = []
    if plus and minus:
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)
    elif plus:
        x = plus.popleft()
        y = plus.pop()
        res.append([x, y])
        minus.append(x - y)
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        x = plus.pop()
        y = minus.pop()
        res.append([x, y])
        plus.append(x - y)
    else:
        x = minus.pop()
        y = minus.popleft()
        res.append([x, y])
        plus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)

    print(*plus)
    for i in res:
        print(*i) resolve input = sys.stdin.readline sys.stdin.readline input
import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    if len(A) == 2 and 0 in A:
        print(max(A) - 0)
        print(max(A), 0)
        exit()

    plus = deque(sorted([a for a in A if a >= 0]))
    minus = deque(sorted([a for a in A if a < 0]))

    res = []
    if plus and minus:
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)
    elif plus:
        x = plus.popleft()
        y = plus.pop()
        res.append([x, y])
        minus.append(x - y)
        while len(plus) > 1:
            x = minus.pop()
            y = plus.pop()
            res.append([x, y])
            minus.append(x - y)
        x = plus.pop()
        y = minus.pop()
        res.append([x, y])
        plus.append(x - y)
    else:
        x = minus.pop()
        y = minus.popleft()
        res.append([x, y])
        plus.append(x - y)
        while minus:
            x = plus.pop()
            y = minus.pop()
            res.append([x, y])
            plus.append(x - y)

    print(*plus)
    for i in res:
        print(*i)


if __name__ == '__main__':
    resolve()
