#include <iostream>
#include <vector>

int main()
{
	int n;
	std::cin >> n;
	int h = 0;
	std::vector<int> sv;
	std::vector<int> jv;
	for (int i = 0; i < n; i++) {
		int x;
		std::cin >> x;
		if (x < 0) jv.push_back(x);
		else sv.push_back(x);
	}
	int last = 5;
	int s = 0;
	int j = 0;
	std::vector<int> potezi;
	for (int i = 0; i < 1000000; i++) {
		if (s < sv.size() && j < jv.size()) {
			if (last != 2 && !(sv[s] == h + 1)) {
				j++;
				last = 2;
				potezi.push_back(2);
			}
			else if (last != 1 || sv[s] == h + 2) {
				s++;
				last = 1;
				potezi.push_back(1);
			}
			else {
				h++;
				last = 3;
				potezi.push_back(3);
			}
		}
		else if (s < sv.size()) {
			if (last != 1) {
				s++;
				last = 1;
				potezi.push_back(1);
			}
			else {
				h++;
				last = 3;
				potezi.push_back(3);
			}
		}
		else if (j < jv.size()) {
			if (last != 2) {
				j++;
				last = 2;
				potezi.push_back(2);
			}
			else {
				h++;
				last = 3;
				potezi.push_back(3);
			}
		}
		else break;
		if (j < jv.size()) {

			for (int k = j; k < jv.size(); k++) {
				jv[k]++;
			}
			if (jv[j] == h) break;
		}
		if (s < sv.size()) {
			for (int k = s; k < sv.size(); k++) {
				sv[k]--;
			}
			if (sv[s] == h) break;
		}
	}
	std::cout << s + j << std::endl;
	for (int i = 0; i < potezi.size(); i++) std::cout << potezi[i];
}