#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    vector<int> levi(0);
    vector<int> desni(0);
    for(int i = 0; i < n; i++){
        cin >> v[i];
        if(v[i] < 0){
            levi.push_back(v[i]);
        }
        else{
            desni.push_back(v[i]);
        }
    }
    sort(begin(levi),end(levi));
    sort(begin(desni),end(desni));
    int d = 0;
    int hari = 0;
    int potez = 0;
    string s = "";
    int najl = levi[levi.size()-1];
    int najd = desni[0];
    int indl = levi.size() - 1;
    int indd = 0;
    while((levi.size() > 0 || desni.size() > 0) && potez < 1000000){
        if(abs(hari-najl) < abs(hari-najd)){
            s.push_back(2);
            d++;
            levi.pop_back();
            najl = levi[levi.size()-1];
            potez++;
        }
        else{
            s.push_back(1);
            d++;
            desni[indd] = desni[desni.size()-1] + 1;
            sort(begin(desni),end(desni));
            desni.pop_back();
            najd = desni[0];
            potez++;
        }
    }
    cout << d << endl << s << endl;
}