#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

bool clorting(const ll a,const ll b){
    if (abs(a)<abs(b)){
        return true;
    }
    return false;
}
ll distance(ll d, ll h,ll k){
    return abs(d-h)-k;
}


const ll mapotezi=1000000;

int main(){
    ll n,h=0;
    cin >> n;
    vector<ll> demispred,demiza; // mozda da imam 2 liste: demispred i demiza
    for (int i=0; i<n; i++){
        ll a;
        cin >> a;
        if (a>0){
            demispred.push_back(a);
        }
        else{
            demiza.push_back(a);
        }
    }
    sort(begin(demispred),end(demispred),clorting);
    sort(begin(demiza),end(demiza),clorting);
    int lastmove=-1; // 1->pos, 2->neg, 3->unapred (+1) (prio pos) ne moze unazad da ide bitno bitno bitno bitno
    ll demiz=0,demis=0;
    string potezi="";
    for (int i=0; i<mapotezi; i++){
        if (demis>=demispred.size()){
            if (distance(demiza[demiz],h,i)<=0 || (demiz>=demiza.size())){
                break;
            }
            else if (lastmove==3){
                demiz++;
                lastmove=2;
                potezi+="2";
            }
            else if (lastmove==2){
                h++;
                lastmove=3;
                potezi+="3";
            }
            else if (lastmove==1){
                demiz++;
                lastmove=2;
                potezi+="2";
            }

        }

        else if (demiz>=demiza.size()){
            if (distance(demispred[demis],h,i)<=0 || (demis>=demispred.size())){
                break;
            }
            else if (lastmove==3){
                demis++;
                lastmove=1;
                potezi+="1";
            }
            else if (lastmove==2){
                demis++;
                lastmove=1;
                potezi+="1";
            }
            else if (lastmove==1){
                demiz++;
                lastmove=2;
                potezi+="2";
            }

        }
        else if (distance(demiza[demiz],h,i)<=0 || distance(demispred[demis],h,i)<=0 || (demiz>=demiza.size() && demis>=demispred.size())){
            break;
        }
        else if(lastmove!=2 && distance(demiza[demiz],h,i)<distance(demispred[demis],h,i)){
            lastmove=2;
            demiz++;
            potezi+="2";
        }
        else if (lastmove!=1 && distance(demiza[demiz],h,i)>=distance(demispred[demis],h,i)){
            lastmove=1;
            demis++;
            potezi+="1";
        }
        else if (lastmove==2 && distance(demiza[demiz],h,i)==1){
            h++;
            lastmove=3;
            potezi+="3";
        }
    }
    cout << demis+demiz << endl;
    cout << potezi << endl;
    return 0;
}