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

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// ---------------------------  TEMPLATE ENDS  -------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9+7;
const int inf = 2e18;
const ld eps = 1e-9;
const int NN = 1e5 + 2;

vvi adj;
string to_string(string s) {
	return '"' + s + '"';
}
string to_string(const char* s) {
	return to_string((string) s);
}
string to_string(bool b) {
	return (b ? "true" : "false");
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
	bool first = true;  string res = "{";
	for (const auto &x : v) {
		if (!first) { res += ", "; }
		first = false; res += to_string(x);
	}
	res += "}";	  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

// /#define TRACE

#ifdef TRACE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
bool chck(int x1, int y1, int x2, int y2, int p, int q) {
	int x = x2-x1, y = y2 - y1;
	if(p == 0) {
		return x == 0 and y%q == 0;
	}
	if(q == 0) {
		return y == 0 and x%p == 0;
	}
	if(x%p == 0 and y%q == 0 and x/p == y/q) return 1;
	return 0;
}


void solve(){
	int i = 0, j = 0, k = 0, n = 0, m = 0;
	cin >> n;
	bool f = 0;
	multiset<int> pos, neg;
	vi a(n);
	fr(i, 0, n) {
		cin>>k;
		a[i] = k;
		if(k >= 0) pos.insert(k);
		else neg.insert(k);
	}
	vpi ans;
	if(n == 2) {
		int M = max(a[0], a[1]);
		m = min(a[0], a[1]);
		cout << M << endl << M << ' ' << m;
		return ;
	}
	while(1) {
		int s1 = pos.size(), s2 = neg.size();
		if(s1+s2 == 2) break;
		if(s2 == 0) {
			auto b = pos.begin();
			auto bb = pos.begin();
			bb++;
			ans.eb(*b, *bb);
			k = *b - *bb;
			pos.erase(b);
			pos.erase(bb);
			neg.insert(k);
		}
		else if(s2 == 1) {
			auto b = neg.begin();
			auto bb = pos.begin();
			ans.eb(*b, *bb);
			k = *b - *bb;
			pos.erase(bb);
			neg.erase(b);
			neg.insert(k);
		}
		else {
			if(s1 > 0) {
				auto b = pos.begin();
				auto bb = neg.begin();
				ans.eb(*b, *bb);
				k = *b - *bb;
				pos.erase(b);
				neg.erase(bb);
				pos.insert(k);
			}
			else {
				auto b = neg.begin();
				auto bb = neg.end();
				bb--;
				ans.eb(*bb, *b);
				k = *bb - *b;
				neg.erase(b);
				neg.erase(bb);
				pos.insert(k);
			}
		}
	}
	
	auto p = pos.begin();
	auto b = neg.begin();
	ans.eb(*p, *b);
	int v = *p - *b;
	cout << v << endl;
	for(auto P : ans) cout << P.fi<< ' '<<P.se<<el;

}

int32_t main(){
#ifndef TRACE
	ios::sync_with_stdio(false); cin.tie(0); 
#endif
	int T = 1, tc;
	for(tc = 1; tc <= T; tc++){
		solve();
	}
	return 0;
}

Measured memory_bytes: 8952