# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

const int N = 200010;
struct Tree{
	int pl, pr, mx;
}T[N * 110];
int rt0[N], rt1[N], p[N], n, ans[N], place , vis[N], pre[N];
void modify(int &p, int las, int id, int num, int l, int r){
	p = ++place;
	T[p].mx = max(T[las].mx, num);
	if (l == r) return;
	int mid = (l + r) / 2;
	if (mid >= id){
		modify(T[p].pl, T[las].pl, id, num, l, mid);
		T[p].pr = T[las].pr;
	}
	else {
		modify(T[p].pr, T[las].pr, id, num, mid + 1, r);
		T[p].pl = T[las].pl;
	}
}
int query(int p, int ql, int qr, int l, int r){
	if (p == 0 || ql > qr) return 0;
	if (ql == l && qr == r) return T[p].mx;
	int mid = (l + r) / 2;
	if (qr <= mid) return query(T[p].pl, ql, qr, l, mid);
		else if (ql > mid) return query(T[p].pr, ql, qr, mid + 1, r);
			else return max(query(T[p].pl, ql, mid, l, mid), query(T[p].pr, mid + 1, qr, mid + 1, r));
}
int main(){
	read(n);
	for (int i = 1; i <= n; i++) read(p[i]);
	int tmp = 0;
	for (int i = 1; i <= n; i++){
		if (p[i] > tmp){
			vis[i] = 1;
			tmp = p[i];
		}
		else vis[i] = 0;
		pre[i] = pre[i - 1] + vis[i];
	}
	for (int i = n; i >= 1; i--){
		int cnt0 = query(rt0[i + 1], p[i] + 1, n, 1, n), cnt1 = query(rt1[i + 1], p[i] + 1, n, 1, n);
		if (vis[i] == 0){
			swap(cnt0, cnt1);
			cnt0++, cnt1++;
		}
		else cnt0 += 2, cnt1 += 2;
		if (cnt1 % 2 == 0) cnt1 = 0;
		if (cnt0 % 2 == 1) cnt0 = 0;
		modify(rt0[i], rt0[i + 1], p[i], cnt0, 1, n); modify(rt1[i], rt1[i + 1], p[i], cnt1, 1, n);
	}
	int h0 = 0, h1 = 0, nh0, nh1, num0 = 0, num1 = 0, tmp0, tmp1;
	for (int i = 1; i <= n; i++){
		if (h0 < p[i]) nh0 = p[i], tmp0 = num0 + 1;
			else nh0 = h0, tmp0 = num0;
		nh1 = h1, tmp1 = num1;
		int q = pre[n] - pre[i], num = tmp0 - tmp1 + q, g;
		if (num % 2 == 0) g = query(rt0[i + 1], h1 + 1, n, 1, n);
			else g = query(rt1[i + 1], h1 + 1, n, 1, n);
		if (g >= num && num >= 0){
			ans[i] = 0;
			h0 = nh0, h1 = nh1;
			num0 = tmp0, num1 = tmp1;
			continue;
		}
		num = tmp1 - tmp0 + q;
		if (num % 2 == 0) g = query(rt0[i + 1], h0 + 1, n, 1, n);
			else g = query(rt1[i + 1], h0 + 1, n, 1, n);
		if (g >= num && num >= 0){
			ans[i] = 0;
			h0 = nh0, h1 = nh1;
			num0 = tmp0, num1 = tmp1;
			continue;
		}
		
		if (h1 < p[i]) nh1 = p[i], tmp1 = num1 + 1;
			else nh1 = h1, tmp1 = num1;
		nh0 = h0, tmp0 = num0;
		num = tmp0 - tmp1 + q;
		if (num % 2 == 0) g = query(rt0[i + 1], h1 + 1, n, 1, n);
			else g = query(rt1[i + 1], h1 + 1, n, 1, n);
		if (g >= num && num >= 0){
			ans[i] = 1;
			h0 = nh0, h1 = nh1;
			num0 = tmp0, num1 = tmp1;
			continue;
		}
		num = tmp1 - tmp0 + q;
		if (num % 2 == 0) g = query(rt0[i + 1], h0 + 1, n, 1, n);
			else g = query(rt1[i + 1], h0 + 1, n, 1, n);
		if (g >= num && num >= 0){
			ans[i] = 1;
			h0 = nh0, h1 = nh1;
			num0 = tmp0, num1 = tmp1;
			continue;
		}
		printf("-1\n");
		exit(0);
	}
	for (int i = 1; i <= n; i++)
		printf("%d", ans[i]);
	printf("\n");
	return 0;
}



Measured memory_bytes: 94592