#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define int long long
#define rep(i, a, b) for (ll i = (a); i <= (b); ++i)
#define per(i, a, b) for (ll i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (ll i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((ll)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <ll, ll> pii ;
typedef vector <ll> vi ;
typedef vector <pii> vii ;
typedef queue <ll> qi ;
typedef queue <pii> qii ;
typedef set <ll> si ;
typedef map <ll, ll> mii ;
typedef map <string, ll> msi ;
const ll maxn = 2e6 + 100 ;
const ll inf = 0x3f3f3f3f ;
const ll iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const double eps = 1e-7 ;
template <class T = ll> T chmin(T &a, T b) { return a = min(a, b);}
template <class T = ll> T chmax(T &a, T b) { return a = max(a, b);}
template <class T = ll> T read()
{
	T f = 1, a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	return a * f ;
}

ll n;

ll a[maxn], b[maxn], p[maxn], cntx, cnty, hx, hy;

ll f[maxn][2];

char ans[maxn];

struct binary_indexed_tree
{
	ll val[maxn];
	void init()
	{
		rep(i, 1, n) val[i] = -linf;
	}
	void modify(ll pos, ll x)
	{
		for(ll i = pos; i <= n; i += lowbit(i)) chmax(val[i], x);
	}
	ll query(ll pos)
	{
		ll ret = -linf;
		for(ll i = pos; i; i -= lowbit(i)) chmax(ret, val[i]);
		return ret;
	}
}
odd, even;

struct node
{
	ll l, r, val[2];
}
tr[maxn];

#define mid ((tr[tot].l + tr[tot].r) >> 1)
#define ls (tot << 1)
#define rs (ls | 1)

void maintain(ll tot)
{
	tr[tot].val[0] = max(tr[ls].val[0], tr[rs].val[0]);
	tr[tot].val[1] = max(tr[ls].val[1], tr[rs].val[1]);
}

void build(ll tot, ll l, ll r)
{
	tr[tot].l = l, tr[tot].r = r;
	if(l == r) return ;
	build(ls, l, mid), build(rs, mid + 1, r);
	maintain(tot);
}

void modify(ll tot, ll pos, ll x, ll y)
{
	if(tr[tot].l == tr[tot].r) return (void)(tr[tot].val[0] = x, tr[tot].val[1] = y);
	if(pos <= mid) modify(ls, pos, x, y);
	else modify(rs, pos, x, y);
	maintain(tot);
}

ll wdnmd;

ll query(ll tot, ll l, ll r, ll typ)
{
	wdnmd ++;
	if(l > r) return typ * -linf;
	if(tr[tot].l >= l && tr[tot].r <= r) return tr[tot].val[typ];
	ll ret = typ * -linf;
	if(l <= mid) chmax(ret, query(ls, l, r, typ));
	if(r > mid) chmax(ret, query(rs, l, r, typ));
	return ret;
}

void print(ll tot)
{
	if(tr[tot].l == tr[tot].r)
	{
		printf("%lld : %lld %lld\n", tr[tot].l, tr[tot].val[0], tr[tot].val[1]);
		return ;
	}
	print(ls), print(rs);
}

signed main()
{
	// freopen("makedata.out", "r", stdin);
	n = read();
	rep(i, 1, n) a[i] = read();
	ll maxx = 0;
	rep(i, 1, n) if(a[i] > maxx) maxx = a[i], b[i] = 1;
	per(i, n, 1) p[i] = b[i] + p[i + 1];
	odd.init(), even.init();
	f[n + 1][1] = -linf;
	per(i, n, 1)
	{
		if(b[i])
		{
			f[i][0] = max(2ll, even.query(n - a[i] + 1) + 2);
			f[i][1] = odd.query(n - a[i] + 1) + 2;
		}
		else
		{
			f[i][0] = odd.query(n - a[i] + 1) + 1;
			f[i][1] = max(1ll, even.query(n - a[i] + 1) + 1);
		}
		even.modify(n - a[i] + 1, f[i][0]);
		odd.modify(n - a[i] + 1, f[i][1]);
	}
	build(1, 1, n);
	rep(i, 1, n) modify(1, a[i], f[i][0], f[i][1]);//, printf("%lld : %lld %lld\n", i, f[i][0], f[i][1]);
	if(query(1, 1, n, p[1] & 1) < p[1]) return puts("-1"), 0;
	rep(i, 1, n)
	{
		// printf("i : %lld\n", i);
		// printf("%lld %lld %lld %lld %lld\n", cntx, hx, cnty, hy, p[i + 1]);
		// print(1);
		// if(i % 100 == 0) cerr << i << "   " << wdnmd << endl;
		modify(1, a[i], 0, -linf);
		ll tcnt = cntx, tval = hx;
		if(a[i] > hx) tval = a[i], tcnt ++;
		ll tmp = p[i + 1] + tcnt - cnty, flag = 0;
		if(tmp >= 0 && query(1, hy + 1, n, tmp & 1) >= tmp) flag = 1;
		tmp = p[i + 1] + cnty - tcnt;
		if(tmp >= 0 && query(1, tval + 1, n, tmp & 1) >= tmp) flag = 1;
		if(flag)
		{
			ans[i] = '0';
			cntx = tcnt, hx = tval;
		}
		else
		{
			ans[i] = '1';
			if(a[i] > hy) hy = a[i], cnty ++;
		}
	}
	printf("%s\n", ans + 1);
	return 0;
}

Measured memory_bytes: 31056