#include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
int main() {
	int a;
	cin >> a;
	vector<int> v(a);
	vector<int> v1;
	vector<int> v2;
	for (int i = 0; i < a; i++) cin >> v[i];
	v1 = v;
	sort(v.begin(), v.end());
	int i = 0;
	int q = 1;
	int d = 0;
	while (abs(v[i]) >= abs(v[q]) && q < v.size()-1) {
		d = min(abs(v[i]), abs(v[q]));
		if (d == abs(v[q])) i == q;
		q++;
	}
	int brojac = 0;
	while (true) {
		if (brojac == 0){
			if (v[i] + brojac < 0) {
				v2.push_back(2);
				v[i] = 999999999;
				sort(v.begin(), v.end());
				v.pop_back();
			}
			else if (v[i] - brojac > 0) {
				v2.push_back(1);
				v[i] = 999999999;
				sort(v.begin(), v.end());
				v.pop_back();
			}
			else if (abs(v[i]) - brojac != 0 && abs(v[i]) != 1) { v2.push_back(3); brojac++; }
			else break;
		}
		else{
			if (v[i] + brojac < 0 && v2.back() != 2) {
				v2.push_back(2);
				v[i] = 999999999;
				sort(v.begin(), v.end());
				v.pop_back();
			}
			else if (v[i] - brojac > 0 && v2.back() != 1) {
				v2.push_back(1);
				v[i] = 999999999;
				sort(v.begin(), v.end());
				v.pop_back();
			}
			else if (abs(v[i]) - brojac != 0 && v2.back() != 3 && abs(v[i]) != 1) { v2.push_back(3); brojac++; }
			else break;
		}
		if (v.size() == 0) break;
		if (i > 0 && i < v.size() - 1)
			i = min(abs(v[i - 1]), min(abs(v[i + 1]), abs(v[i])));
		else if (i > 0) min(abs(v[i]),abs(v[i - 1]));
		else if (i < v.size() - 1) min(v[i], v[i + 1]);
		brojac++;
	}
	cout << v1.size() - v.size() << endl;
	for (int i = 0; i < v2.size(); i++)cout << v2[i];
	return 0;
}