#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
const int N = 200064, inf = 0xcdcdcdcd;
inline void Max(int &a, int b) {if (a < b) a = b;}

int p[N], f[2][N], t[N], n;
bool h[N];
vector<pair<int*,int>> stk;

void upd(int (&tr)[N], int x, int v) {
	do if (tr[x] < v) {
		stk.emplace_back(tr+x, tr[x]);
		tr[x] = v;
	  }
	while (x &= x-1);
}
int qry(int (&tr)[N], int x) {
	int v = inf-8;
	do Max(v, tr[x]);
	while ((x += x&-x) <= n);
	return v;
}

inline bool chk(int h1, int d) {	// d = c0 - c1 + q;
	return d >= 0 && qry(f[d&1], h1) >= d;
}
inline bool check(int h0, int h1, int d, int q) {	// d = c0 - c1
	return chk(h0, q - d) || chk(h1, q + d);
}

int main() {
	scanf("%d",&n);
	memset(f[1]+1, 0xcc, n<<2);
	int q = 0;
	for (int i = 0, mx = 0; i < n; i++) {
		scanf("%d",p+i);
		if (p[i] > mx) {
			mx = p[i];
			h[i] = true;
			q++;
		}
	}
	for (int i = n, g0, g1; i--;) {
		t[i] = stk.size();
		if (h[i]) {	//w = 2
			g0 = qry(f[0], p[i]) + 2;
			g1 = qry(f[1], p[i]) + 2;
		} else {	//w = 1
			g0 = qry(f[1], p[i]) + 1;
			g1 = qry(f[0], p[i]) + 1;
		}
		if (g0 > inf) upd(f[0], p[i], g0);
		if (g1 > inf) upd(f[1], p[i], g1);
	}
	if (!chk(1, q)) {puts("-1"); return 0;}
	int h0 = 1, h1 = 1, d = 0, top = stk.size();
	for (int i = 0; i < n; i++) {
		q -= h[i];
		while (top > t[i]) {	//undo
			auto &p = stk[--top];
			*p.first = p.second;
		}
		if (h0 <= p[i])
			if (check(p[i], h1, d+1, q)) {
				putchar('0');
				h0 = p[i]; d++;
			} else {
				putchar('1');
				if (h1 <= p[i])
					h1 = p[i], d--;
			}
		else if (check(h0, h1, d, q))
				putchar('0');
			else {
				putchar('1');
				if (h1 <= p[i])
					h1 = p[i], d--;
			}
	}
	return 0;
}
