#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 = 0;
    int p = 0;
    int res = 0;

    string potezi;

    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 (!pos.empty() && prev != 1 && (neg.empty() || prev == 2 || abs(up) <= abs(down))){
            pos.pop();
            ++res;
            prev = 1;
        }else if(!neg.empty() && prev != 2 && (pos.empty() || prev == 1 || abs(down) > abs(up))){
            neg.pop();
            ++res;
            prev = 2;
        }else{
            prev = 3;
            ++p;
        }

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

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

    return 0;
}