#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >>n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    vector<pair<int,int>> ans;
    if (n==2){
        ans.emplace_back(a[1],a[0]);
    }
    else if(a[n-1]<=0){
        ans.emplace_back(make_pair(a[n-1],a[0]));
        for(int i = 1; i<n-1; i++){
            ans.emplace_back(ans[i-1].first-ans[i-1].second,a[i]);
        }
    }
    else if(a[0]>=0){
        ans.emplace_back(a[0],a[n-2]);
        for(int i = 1; i<n-2; i++){
            ans.emplace_back(ans[ans.size()-1].first-ans[ans.size()-1].second,a[i]);
        }
        ans.emplace_back(a[n-1],ans[ans.size()-1].first-ans[ans.size()-1].second);
    }
    else{
        int flag = lower_bound(all(a),0) - a.begin();
        if(flag==n-1){
            ans.emplace_back(make_pair(a[n-1],a[0]));
            for(int i = 1; i<n-1; i++){
                ans.emplace_back(ans[i-1].first-ans[i-1].second,a[i]);
            }
        }
        else{
            ans.emplace_back(a[0],a[flag]);
            debug(flag);
            for(int i = flag+1; i<n-1; i++){
                ans.emplace_back(ans[ans.size()-1].first-ans[ans.size()-1].second,a[i]);
            }
            ans.emplace_back(a[n-1],ans[ans.size()-1].first-ans[ans.size()-1].second);
            int m = ans.size();
            for(int i = 1; i<flag; i++){
                ans.emplace_back(ans[m+i-2].first-ans[m+i-2].second,a[i]);
            }
        }
    }
    cout << ans[n-2].first - ans[n-2].second << endl;
    rep(i,ans.size()){
        cout << ans[i].first << " " << ans[i].second << endl;
    }
}

Measured memory_bytes: 3188