#include <iostream>

const int N = 200000 + 7, T = N * 100;

int n;
int a[N], b[N], d[N];

int rt[N][2];
int kid[T][2], dat[T], ct;
void insert(int& p, int lp, int l, int r, int x, int y) {
	dat[p = ++ct] = dat[lp];
	kid[p][0] = kid[lp][0];
	kid[p][1] = kid[lp][1];
	if (l == r)
		dat[p] = std::max(dat[p], y);
	else {
		int m = l + r >> 1;
		if (x <= m) insert(kid[p][0], kid[lp][0], l, m, x, y);
		else insert(kid[p][1], kid[lp][1], m + 1, r, x, y);
		dat[p] = std::max(dat[kid[p][0]], dat[kid[p][1]]);
	}
}
int get(int p, int l, int r, int x, int y) {
	if (x > y) return -(1 << 28);
	if (x <= l && r <= y) return dat[p];
	int m = l + r >> 1, t = -(1 << 28);
	if (x <= m) t = std::max(t, get(kid[p][0], l, m, x, y));
	if (y > m) t = std::max(t, get(kid[p][1], m + 1, r, x, y));
	return t;
}

int f0, f1, g0, g1;
int ok(int m) {
	int f;
	f = f1 - f0 + d[m + 1];
	if (0 <= f && f <= get(rt[m + 1][f & 1], 1, n, g0 + 1, n)) return 1;
	f = f0 - f1 + d[m + 1];
	if (0 <= f && f <= get(rt[m + 1][f & 1], 1, n, g1 + 1, n)) return 1;
	return 0;
}

int s[N];

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		scanf("%d", a + i), b[i] = std::max(a[i], b[i - 1]);
	for (int i = n; i; --i) {
		d[i] = d[i + 1] + (a[i] == b[i]);
		int f0 = std::max(0, get(rt[i + 1][0], 1, n, a[i] + 1, n)) + 1 + (a[i] == b[i]);
		int f1 = std::max(0, get(rt[i + 1][1], 1, n, a[i] + 1, n)) + 1 + (a[i] == b[i]);
		rt[i][0] = rt[i + 1][0], rt[i][1] = rt[i + 1][1];
		insert(rt[i][f0 & 1], rt[i][f0 & 1], 1, n, a[i], f0);
		insert(rt[i][f1 & 1], rt[i][f1 & 1], 1, n, a[i], f1);
	}

	f0 = 1, g0 = a[1];
	for (int i = 2; i <= n; ++i) {
		int lg0 = g0;
		if (a[i] > g0) g0 = a[i], ++f0;
		if (s[i] = !ok(i)) {
			if (a[i] > lg0) g0 = lg0, --f0;
			if (a[i] > g1) g1 = a[i], ++f1;
		}
	}
	if (f0 != f1)
		printf("-1");
	else
		for (int i = 1; i <= n; ++i) printf("%d", s[i]);
	return 0;
}
