#include <bits/stdc++.h>

using namespace std;

#define MAX 1000000

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

    int n;cin>>n;
    vector<int> vec(n);

    for (int i = 0; i < n; ++i){
        cin>>vec[i];
    }

    sort(vec.begin(), vec.end());

    queue<int> pos, neg;

    for (int i = 0; i < n; ++i){
        if (vec[i] > 0){
            pos.push(vec[i]);
        }
    }

    for (int i = n - 1; i >= 0; --i){
        if (vec[i] < 0)
            neg.push(vec[i]);
    }

    int potez = 0;
    int prev = 3;
    int p = 0;
    int res = 0;

    string potezi;

    auto popUp = [&](){
        prev = 1;
        ++res;
        pos.pop();
    };

    auto popDown = [&](){
        prev = 2;

        if (!neg.empty()){
            neg.pop();
            ++res;
        }
    };

    auto go = [&](){
        ++p;
        prev = 3;
    };

    while (potez < MAX && !(pos.empty() && neg.empty())){
        int up = pos.empty() ? -1 : pos.front() - potez - p;
        int down = neg.empty() ? -1 : neg.front() + potez - p;

        if ((!pos.empty() && up <= 0) || (!neg.empty() && down >= 0))
            break;

        if (prev == 3){
            if (!pos.empty() && !neg.empty()){
                if (abs(up) < abs(down)){
                    popUp();
                }else{
                    popDown();
                }
            }else if(pos.empty()){
                popDown();
            }else{
                popUp();
            }
        }else if(prev == 2){
            if (!pos.empty()){
                if (!neg.empty()){
                    if (abs(down) < max(up - 2, 0)){
                        go();
                    }
                    else{
                        popUp();
                    }
                }else{
                   popUp();
                }
            }
            else
                go();
        }else{
            popDown();
        }

        potezi += '0' + prev;
        ++potez;
    }

    cout<<res<<'\n'<<potezi;

    return 0;
}