#include <bits/stdc++.h>
using namespace std;
using ll=long long;
typedef pair<int,int> P;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a.at(i);
    sort(a.begin(),a.end());
    queue<P> Q;
        for(int i=0;i<n-2;i++){
        if(a.at(i)<=0&&a.at(i+1)<=0){
            Q.push(P(a.at(n-1),a.at(i)));
           a.at(n-1)-=a.at(i);
        }
        else if(a.at(i+1)>0){
            Q.push(P(a.at(i),a.at(i+1)));
            a.at(i+1)=a.at(i)-a.at(i+1);
        }
    }
    Q.push(P(a.at(n-1),a.at(n-2)));
    cout<<a.at(n-1)-a.at(n-2)<<endl;
    while(!Q.empty()){
        P q=Q.front();
        Q.pop();
       cout<<q.first<<" "<<q.second<<endl;
    }
}