#pragma GCC target("tune=native")
#include <bits/stdc++.h>
using namespace std;

const int N = 200005;
int n, m, p[N], val[N], T[2][N * 3];
char ans[N];

void modify(int *T, int p, int v) {
	for (T[p += m] = v; p >>= 1;) {
		int w = max(T[p << 1], T[p << 1 | 1]);
		if (w == T[p]) break;
		T[p] = w;
	}
}
int query(int *T, int s) {
	int res = -(2 * N);
	for (s += m; s >>= __builtin_ctz(~s); s >>= 1) res = max(res, T[s ^ 1]);
	return res;
}

bool check(int x, int y) {
	return x >= 0 && x <= query(T[x & 1], y);
}

int main() {
	scanf("%d", &n);
	m = 1;
	while (m <= n) m <<= 1;
	for (int i = 1; i <= m + n + 1; ++i) T[1][i] = -(2 * N);
	int Q = 0, mx = 0;
	for (int i = 1; i <= n; ++i) {
		scanf("%d", p + i);
		if (p[i] > mx) mx = p[i], val[i] = 2, ++Q;
		else val[i] = 1;
	}
	for (int i = n; i; --i) {
		int tmp[2];
		for (int j = 0; j < 2; ++j) {
			tmp[j] = query(T[j ^ val[i] & 1], p[i]) + val[i];
			if (tmp[j] < 0) tmp[j] = -(2 * N);
		}
		for (int j = 0; j < 2; ++j) modify(T[j], p[i], tmp[j]);
	}
	if (!check(Q, 0)) return puts("-1"), 0;
	int c[2] = {}, h[2] = {};
	for (int i = 1; i <= n; ++i) {
		modify(T[0], p[i], 0), modify(T[1], p[i], -(2 * N));
		Q -= val[i] - 1;
		ans[i] = !(check(Q + c[1] - (c[0] + (p[i] > h[0])), max(h[0], p[i])) || check(Q - c[1] + (c[0] + (p[i] > h[0])), h[1]));
		if (p[i] > h[ans[i]]) ++c[ans[i]], h[ans[i]] = p[i];
		ans[i] += '0';
	}
	puts(ans + 1);
	return 0;
}
