#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

template<class T> struct RXQ {
    static const int npos = -1;

    int n, m;
    vector<T> d;
    RXQ() {}
    RXQ(int n_, const T init=T()) : n(n_), m(2<<__lg(max(1, n))), d(2*m, init) {}
    template<class Iter> void build(Iter begin, Iter end, const T init=T()) {
	n = end - begin;
	m = 2<<__lg(max(1, n));
	d.resize(2*m);
	for (int i=0; begin!=end; ++begin, i++) d[i+m] = *begin;
	for (int i=n; i<m; i++) d[i+m] = init;
	for (int i=m; --i; ) d[i] = max(d[i*2+1], d[i*2]);
    };

    const T at(int i) const { return d[i+m]; }

    void modify(int i, const T v) {
	i += m; d[i] = v;
	for (i>>=1; i; i>>=1) d[i] = max(d[i*2+1], d[i*2]);
    }

    T max_v(int l, int r) const {
	l += m; r += m;
	T ret = d[l++];
	for (; l<r; l>>=1, r>>=1) {
	    if (l & 1) { amax(ret, d[l]); l++; }
	    if (r & 1) { r--; amax(ret, d[r]); }
	}
	return ret;
    }

    int max_i(int l, int r) const {
	return first_more_equeal(l, max_v(l, r));
    }

    // for i in [l .. n-1]:
    //   if at(i) > v: return i;
    // return npos;
    int first_more_than(int l, const T v) const {
	int r = 2*m;
	for (l+=m; l<r; l>>=1, r>>=1) {
	    if (l & 1) {
		if (v < d[l]) break;
		l++;
	    }
	}
	if (l >= r) return npos;
	for (; l<m;) {
	    if (v < d[l*2]) l = l*2;
	    else l = l*2+1;
	}
	return l - m;
    }

    // for i in [l .. n-1]:
    //   if v <= at(i): return i;
    // return npos;
    int first_more_equal(int l, const T v) const { 
	int r = 2*m;
	for (l+=m; l<r; l>>=1, r>>=1) {
	    if (l & 1) {
		if (v <= d[l]) break;
		l++;
	    }
	}
	if (l >= r) return npos;
	for (; l<m;) {
	    if (v <= d[l*2]) l = l*2;
	    else l = l*2+1;
	}
	return l - m;
    }

    // for i in [r-1 .. 0]:
    //   if v < at(i): return i;
    // return npos;
    int last_more_than(int r, const T v) const {
	if (r < m) {
	    for (r+=m; 1<r; r>>=1) {
		if (r & 1) {
		    r--;
		    if (v < d[r]) break;
		}
	    }
	    if (r <= 1) return npos;
	} else {
	    if (v < d[1]) r = 1;
	    else return npos;
	}
	for (; r<m; ) {
	    if (v < d[r*2+1]) r = r*2+1;
	    else r = r*2;
	}
	return r - m;
    }

    // for i in [r-1 .. 0]:
    //   if v <= at(i): return i;
    // return npos;
    int last_more_equal(int r, const T v) const { 
	if (r < m) { 
	    for (r+=m; 1<r; r>>=1) {
		if (r & 1) {
		    r--;
		    if (v <= d[r]) break;
		}
	    }
	    if (r <= 1) return npos;
	} else {
	    if (v <= d[1]) r = 1;
	    else return npos;
	}
	for (; r<m; ) {
	    if (v <= d[r*2+1]) r = r*2+1;
	    else r = r*2;
	}
	return r - m;
    }
};

int N;
int A[200011];

bool H[200011];
const int INF = 1<<29;
RXQ<int> S[2];

char ans[200011];

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d", A+i), A[i]--;

    int high = -1;
    REP (i, N) {
	if (A[i] > high) {
	    H[i] = true;
	    high = A[i];
	}
    }

    S[0] = RXQ<int>(N+2, 0);
    S[1] = RXQ<int>(N+2, -INF);

    for (int i=N; i--;) {
	int tmp0 = S[0].max_v(A[i]+1, N);
	int tmp1 = S[1].max_v(A[i]+1, N);
	if (H[i]) {
	    S[0].modify(A[i], max(2, tmp0+2));
	    if (tmp1 >= 0) S[1].modify(A[i], tmp1 + 2);
	} else {
	    S[0].modify(A[i], max(0, tmp1 + 1));
	    S[1].modify(A[i], max(1, tmp0+1));
	}
    }

    int cntX = 0, cntY = 0, highX = -1, highY = -1, rest = 0;
    REP (i, N) if (H[i]) rest++;

    {
	bool ok = false;
	int target = cntX - cntY + rest;
	if (0 <= target && target <= S[target&1].max_v(0, N)) {
	    ok = true;
	}
	target = cntY - cntX + rest;
	if (!ok && 0 <= target && target <= S[target&1].max_v(0, N)) {
	    ok = true;
	}
	if (!ok) {
	    puts("-1");
	    return;
	}
    }

    REP (i, N) {
	S[0].modify(A[i], 0);
	S[1].modify(A[i], -INF);

	int cx = cntX + (highX < A[i]? 1: 0);
	int hx = max(highX, A[i]);
	int re = rest - H[i];

	bool ok = false;
	if (!ok) {
	    int target = cx - cntY + re;
	    if (0 <= target && target <= (highY+1<N? S[target&1].max_v(highY+1, N): 0)) {
		ok = true;
	    }
	}
	if (!ok) {
	    int target = cntY - cx + re;
	    if (0 <= target && target <= (hx<N? S[target&1].max_v(hx+1, N): 0)) {
		ok = true;
	    }
	}

	int cy = cntY + (highY < A[i]? 1: 0);
	int hy = max(highY, A[i]);
	if (ok) {
	    ans[i] = '0';
	    cntX = cx;
	    highX = hx;
	    rest -= H[i];
	} else { 
	    ans[i] = '1';
	    cntY = cy;
	    highY = hy;
	    rest -= H[i];
	}
    }

    puts(ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 5760