#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)

const ll MAX = 1e5+10;
const ll MOD = 1e9+10;

ll N;
vi A;

int main() {
    cin >> N;
    A = vi(N);
    REP (i, N) cin >> A[i];
    sort(A.begin(), A.end());

    int a = A[0], b = A[N-1];
    string txt = "";
    FOR(i,1,N-1) {
        if (A[i] < 0) {
            txt += to_string(b) + " " + to_string(A[i]) + "\n";
            b -= A[i];
        } else {
            txt += to_string(a) + " " + to_string(A[i]) + "\n";
            a -= A[i];
        }
    }
    txt += to_string(b) + " " + to_string(a) + "\n";
    cout << b-a << endl;
    cout << txt;
}