#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
#include<numeric>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define PRIM 3
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

Int n;
Int p[220000];
bool high[220000];

Int odd[1 << 20];
Int even[1 << 20];

void set_val(Int *seg, Int pos, Int val){
    pos += 1 << 19;
    seg[pos] = val;
    while(pos >>= 1){
        seg[pos] = max(seg[pos * 2], seg[pos * 2 + 1]);
    }
}

Int max_val(Int *seg, Int l, Int r){
    Int ans = 0;
    l += 1 << 19;
    r += 1 << 19;
    while(l < r){
        if(l % 2 != 0){
            ans = max(ans, seg[l]);
            l++;
        }
        if(r % 2 != 0){
            r--;
            ans = max(ans, seg[r]);
        }
        l /= 2;
        r /= 2;
    }
    return ans;
}

int main(){
    cin >> n;
    int recent_max = -1;
    int high_cnt = 0;
    for(int i = 0;i < n;i++){
        cin >> p[i];
        if(p[i] > recent_max){            
            high_cnt++;
            recent_max = p[i];
            high[i] = true;
        }
    }


    for(int i = n-1;i >= 0;i--){
        int even_max = max_val(even, p[i] + 1, n + 2);
        int odd_max = max_val(odd, p[i] + 1, n + 2);
        if(high[i]){
            set_val(even, p[i], even_max + 2);
            if(odd_max != 0)
                set_val(odd, p[i],odd_max + 2);
        }
        else{
            set_val(odd, p[i], even_max + 1);
            if(odd_max != 0)
                set_val(even, p[i], odd_max + 1);
        }

    }
    
    int mx[2] = {-1, -1};
    int cnt[2] = {0, 0};
    string ans;
    for(int i = 0;i < n;i++){
        high_cnt -= high[i];
        set_val(even, p[i], 0);
        set_val(odd, p[i], 0);
        if(p[i] < mx[0] && p[i] < mx[1]){
            ans.push_back('0');
            continue;
        }

        {
            int tmp_cnt[2] = {cnt[0], cnt[1]};
            int tmp_max[2] = {mx[0], mx[1]};
            if(mx[0] < p[i]){
                tmp_cnt[0]++;
                tmp_max[0] = p[i];
            }
            bool ok = false;
            int diff0 = tmp_cnt[0] - tmp_cnt[1] + high_cnt;
            int diff1 = tmp_cnt[1] - tmp_cnt[0] + high_cnt;
            if(diff0 % 2 == 0 && 0 <= diff0 && diff0 <= max_val(even, tmp_max[1], n+2))ok = true;
            if(diff0 % 2 == 1 && 0 <= diff0 && diff0 <= max_val(odd, tmp_max[1], n+2))ok = true;
            if(diff1 % 2 == 0 && 1 <= diff1 && diff1 <= max_val(even, tmp_max[0], n+2))ok = true;
            if(diff1 % 2 == 1 && 1 <= diff1 && diff1 <= max_val(odd, tmp_max[0], n+2))ok = true;
            if(ok){
                cnt[0] = tmp_cnt[0];
                cnt[1] = tmp_cnt[1];
                mx[0] = tmp_max[0];
                mx[1] = tmp_max[1];
                ans.push_back('0');
                continue;
            }
        }
        
        {
            int tmp_cnt[2] = {cnt[0], cnt[1]};
            int tmp_max[2] = {mx[0], mx[1]};
            if(mx[1] < p[i]){
                tmp_cnt[1]++;
                tmp_max[1] = p[i];
            }
            bool ok = false;
            int diff0 = tmp_cnt[0] - tmp_cnt[1] + high_cnt;
            int diff1 = tmp_cnt[1] - tmp_cnt[0] + high_cnt;
            if(diff0 % 2 == 0 && 0 <= diff0 && diff0 <= max_val(even, tmp_max[1], n+2))ok = true;
            if(diff0 % 2 == 1 && 0 <= diff0 && diff0 <= max_val(odd, tmp_max[1], n+2))ok = true;
            if(diff1 % 2 == 0 && 1 <= diff1 && diff1 <= max_val(even, tmp_max[0], n+2))ok = true;
            if(diff1 % 2 == 1 && 1 <= diff1 && diff1 <= max_val(odd, tmp_max[0], n+2))ok = true;

            if(ok){
                cnt[0] = tmp_cnt[0];
                cnt[1] = tmp_cnt[1];
                mx[0] = tmp_max[0];
                mx[1] = tmp_max[1];
                ans.push_back('1');
                continue;
            }
        }
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 13572