#include<bits/stdc++.h>

using namespace std;

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	int n, i, j, d = 0, brp = 0, poz = 0, brKor = 0;
	bool cooldownS = false, cooldownJ = false, cooldownW = false;
	bool ziv = true;
	
	cin >> n;
	
	deque<int> s(n, 0);
	deque<int> a(n);
	
	for(i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end(), [](int x, int y){
			return abs(x) < abs(y);
	});
	
	while(d < n && brp < 1000000 && ziv == true){
		if(a.front() > poz && abs(poz - a.front()) - brKor > 1 && cooldownS == false){
			s.push_back(1);
			d++;
			brp++;
			a.pop_front();
			brKor++;
			if(d < n && abs(poz - a.front()) - brKor == 0)break;
			cooldownW = false;	
			cooldownS = true;
			cooldownJ = false;
		} 
		else if(a.front() < poz && abs(poz - a.front()) - brKor > 1 && cooldownJ == false){
			s.push_back(2);
			d++;
			brp++;
			a.pop_front();
			brKor++;
			if(d < n && abs(poz - a.front()) - brKor == 0)break;
			cooldownW = false;	
			cooldownS = false;
			cooldownJ = true;
		}
		else if(a.front() < poz && abs(poz - a.front()) - brKor == 1 && cooldownJ == false){
			s.push_back(2);
			d++;
			brp++;
			brKor++;
			a.pop_front();
			if(d < n && abs(poz - a.front()) - brKor == 0)break;	
			cooldownW = false;			
			cooldownS = false;
			cooldownJ = true;	
		}
		else if(a.front() > poz && abs(poz - a.front()) - brKor == 1 && cooldownS == false){
			s.push_back(1);
			d++;
			brp++;
			brKor++;
			a.pop_front();
			if(d < n && abs(poz - a.front()) - brKor == 0)break;	
			cooldownW = false;	
			cooldownS = true;
			cooldownJ = false;		
		}
		else if(cooldownW == false){
			s.push_back(3);
			brp++;
			poz++;
			brKor++;
			if(d < n && abs(poz - a.front()) - brKor == 0) ziv = false;
			if(d < n && abs(poz - a[1]) - brKor == 0) ziv = false;
			cooldownW = true;
			cooldownS = false;
			cooldownJ = false;
			
		}
	}
	
	cout << d << '\n';
	
	while(!s.empty()){
		if(s.front() != 0)cout << s.front();
		s.pop_front();
		
	}
	
	return 0;
}