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

/*
6
-8 4 -2 -4 6 10
*/

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n;
    cin >> n;
    priority_queue<int> neg,pos;
    for(int i = 0;i < n;i++){
        int x;
        cin >> x;
        if(x > 0) pos.push(-x);
        else neg.push(x);
    }

    int d = 0, prv = -1, k = 0, ps = 0;
    vector<int> prev;
    for(int i = 0;i <= 1000000;i++){
        if(pos.empty() && neg.empty()) break;
        if(pos.empty()){
            if(neg.top() + k >= ps) break;
            if(prv == 2) prev.push_back(3);
            d = n;
            while(!neg.empty()) {
                neg.pop();
                prev.push_back(2);
                if(!neg.empty()) prev.push_back(3);
            }
            break;
        }
        if(neg.empty()){
            if(-pos.top() - k <= ps) break;
            if(prv == 1){
                prev.push_back(2);
                k++;
                if(-pos.top() - k - 1 <= ps) break;
            }
            while(!pos.empty()){
                if(-pos.top() - k <= ps) break;
                d++;
                pos.pop();
                prev.push_back(1);
                if(!pos.empty()) prev.push_back(2);
                k += 2;
            }
        }
        else{
            if(-pos.top() - k <= ps || neg.top() + k >= ps) break;
            if(min(abs(-pos.top() - k - ps), abs(neg.top() + k - ps)) == abs(neg.top() + k - ps)){
                if(prv == -1 || prv == 1 || prv == 3){
                    neg.pop();
                    d++;
                    k++;
                    prv = 2;
                }
                else{
                    if(abs(neg.top() + k - ps) == 1){
                        if(pos.top() - k - 1 <= ps + 1) {
                            d++;
                            prev.push_back(1);
                            pos.pop();
                            break;
                        }
                        prv = 3;
                        ps++;
                        k++;
                    }
                    else{
                        d++;
                        pos.pop();
                        prv = 1;
                    }
                }
            }
            else{
                if(prv == 2 || prv == -1 || prv == 3){
                    d++;
                    prv = 1;
                    pos.pop();
                    k++;
                }
                else{
                    d++;
                    neg.pop();
                    prv = 2;
                    k++;
                }
            }
            prev.push_back(prv);
        }
    }
    cout << d << '\n';
    for(auto x : prev) cout << x;

    return 0;
}