#include <bits/stdc++.h>

using namespace std;

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

    long long n; cin >> n;
    vector<long long> boo(n), rightboo, leftboo;
    map<long long, int> indicies;
    vector<char> moves;
    for (long long i = 0; i < n; i++) {
        cin >> boo[i];
        if (boo[i] > 0) rightboo.push_back(boo[i]);
        else leftboo.push_back(-boo[i]);
    }

    //sort(boo.begin(), boo.end(), [](long long a, long long b){
    //    return llabs(a) < llabs(b);
    //});
    sort(rightboo.begin(), rightboo.end(), [](long long a, long long b){
        return llabs(a) > llabs(b);
    });
    sort(leftboo.begin(), leftboo.end(), [](long long a, long long b){
        return llabs(a) > llabs(b);
    });

    for (int i = 0; i < n; i++) {
        indicies[boo[i]] = i;
    }

    int offset = 0, killed = 0, dir = 0;
    while (leftboo.size() > 0 || rightboo.size() > 0) {
        if (rightboo.back() - offset == 0 || leftboo.back() - offset == 0) {
                // cout << "oh hell naw\n";
            break;
        }

        if (rightboo[-1] < leftboo[-1]) {
            if (dir == 0) dir = 1;
            if (dir >= 0) {
                moves.push_back('1');
                if (rightboo.size() > 0) {
                    rightboo.pop_back();
                    killed++;
                }
            }
            else {
                if (leftboo.size() > 0) {
                    // boo[indicies[leftboo[-1]]] = 0;
                    leftboo.pop_back();
                    killed++;
                }
                moves.push_back('2');
            }
        }
        else {
            if (dir == 0) dir = -1;
            if (dir <= 0) {
                moves.push_back('2');
                if (leftboo.size() > 0) {
                    // boo[indicies[leftboo[-1]]] = 0;
                    leftboo.pop_back();
                    killed++;
                }
            }
            else {
                if (rightboo.size() > 0) {
                    // boo[indicies[leftboo[-1]]] = 0;
                    rightboo.pop_back();
                    killed++;
                }
                moves.push_back('1');
            }
        }

        dir *= -1;
        offset++;
        // cout << leftboo.back() - offset << " " << rightboo.back() - offset << "\n";
    }
    cout << killed << "\n";
    for (auto mov : moves) {
        cout << mov;
    }
    cout << "\n";

    // cout << LLONG_MAX << "\n";

    return 0;
}