#include <bits/stdc++.h> 
using namespace std; 
int gi() { 
	int res = 0, w = 1; 
	char ch = getchar(); 
	while (ch != '-' && !isdigit(ch)) ch = getchar(); 
	if (ch == '-') w = -1, ch = getchar(); 
	while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar(); 
	return res * w; 
} 
const int INF = 1e9; 
const int MAX_N = 2e5 + 5;
int N, a[MAX_N], val[MAX_N]; 
#define lson (o << 1)
#define rson (o << 1 | 1)
struct SGT { 
	int mx[MAX_N << 2]; 
	void pushup(int o) { mx[o] = max(mx[lson], mx[rson]); } 
	void build(int o = 1, int l = 1, int r = N) { 
		if (l == r) return (void)(mx[o] = -INF);
		int mid = (l + r) >> 1; 
		build(lson, l, mid), build(rson, mid + 1, r); 
		pushup(o); 
	} 
	void mdf(int pos, int v, int o = 1, int l = 1, int r = N) { 
		if (l == r) return (void)(mx[o] = v); 
		int mid = (l + r) >> 1; 
		if (pos <= mid) mdf(pos, v, lson, l, mid); 
		else mdf(pos, v, rson, mid + 1, r); 
		pushup(o); 
	} 
	int qry(int ql, int qr, int o = 1, int l = 1, int r = N) { 
		if (ql <= l && r <= qr) return mx[o]; 
		int mid = (l + r) >> 1, res = -INF; 
		if (ql <= mid) res = max(res, qry(ql, qr, lson, l, mid)); 
		if (qr > mid) res = max(res, qry(ql, qr, rson, mid + 1, r)); 
		return res; 
	} 
} t[2]; 
int cnt[MAX_N]; 
bool check(int mx, int v) {
	if (v < 0) return 0; 
	int len = t[v & 1].qry(mx, N); 
	return len >= v; 
}

int main () { 
#ifndef ONLINE_JUDGE 
    freopen("cpp.in", "r", stdin); 
#endif 
	N = gi(); 
	for (int i = 1, mx = 0; i <= N; i++) { 
		a[i] = gi(); 
		if (a[i] > mx) mx = a[i], val[i] = 2; 
		else val[i] = 1; 
	} 
	t[1].build(); 
	for (int i = N; i; i--) { 
		int mx0 = t[0].qry(a[i], N), mx1 = t[1].qry(a[i], N); 
		if (val[i] & 1) t[0].mdf(a[i], mx1 + 1), t[1].mdf(a[i], mx0 + 1); 
		else t[0].mdf(a[i], mx0 + 2), t[1].mdf(a[i], mx1 + 2); 
	} 
	for (int i = N; i; i--) cnt[i] = cnt[i + 1] + (val[i] == 2); 
	vector<int> ans; 
	int cntX = 0, cntY = 0, mxX = 0, mxY = 0; 
	for (int i = 1; i <= N; i++) { 
		t[1].mdf(a[i], -INF), t[0].mdf(a[i], 0); 
		int _1 = cntX, _2 = mxX; 
		if (a[i] > mxX) mxX = a[i], ++cntX; 
		if (check(mxY, cntX + cnt[i + 1] - cntY) || check(mxX, cntY + cnt[i + 1] - cntX)) ans.push_back(0); 
		else { 
			cntX = _1, mxX = _2; 
			if (a[i] > mxY) mxY = a[i], ++cntY; 
			ans.push_back(1); 
		} 
	}
	if (cntX != cntY) return puts("-1") & 0; 
	for (int i = 0; i < (int)ans.size(); i++) putchar(ans[i] + '0'); 
	putchar('\n'); 
    return 0; 
} 