// Slower C++ solution:
#include<algorithm>

#include<iostream>

#include<cstring>

#include<cstdlib>

#include<cstdio>

#include<vector>

#include<cmath>

#include<ctime>

#include<queue>

#include<map>

#include<set>

#define LL __int128

#define db double



using namespace std;

const int N=2e5+10;

int rd()

{

    int x=0,w=1;char ch=0;

    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}

    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}

    return x*w;

}

int m0[N<<2],m1[N<<2];

#define mid ((l+r)>>1)

void psup(int o){m0[o]=max(m0[o<<1],m0[o<<1|1]),m1[o]=max(m1[o<<1],m1[o<<1|1]);}

void modif(int o,int l,int r,int x,int y,bool oo)

{

	if(l==r){!oo?m0[o]=y:m1[o]=y;return;}

	if(x<=mid) modif(o<<1,l,mid,x,y,oo);

	else modif(o<<1|1,mid+1,r,x,y,oo);

	psup(o);

}

int quer(int o,int l,int r,int ll,int rr,bool oo)

{

	if(ll<=l&&r<=rr) return !oo?m0[o]:m1[o];

	int an=-(1<<20);

	if(ll<=mid) an=max(an,quer(o<<1,l,mid,ll,rr,oo));

	if(rr>mid) an=max(an,quer(o<<1|1,mid+1,r,ll,rr,oo));

	return an;

}

int n,a[N],f[N][2],sm;

bool b[N],an[N];



int main()

{

	memset(m1,-0x3f3f3f,sizeof(m1));

	n=rd();

	for(int i=1,ma=0;i<=n;++i)

	{

		a[i]=rd();

		if(ma<a[i]) ma=a[i],b[i]=1,++sm;

	}

	for(int i=n;i;--i)

	{

		f[i][1]=-(1<<20);

		int xx=b[i]+1+max(0,quer(1,1,n,a[i],n,0)),yy=b[i]+1+max(0,quer(1,1,n,a[i],n,1));

		f[i][xx&1]=max(f[i][xx&1],xx);

		f[i][yy&1]=max(f[i][yy&1],yy);

		modif(1,1,n,a[i],f[i][0],0);

		modif(1,1,n,a[i],f[i][1],1);

	}

	int c0=0,c1=0,mi0=0,mi1=0;

	for(int i=1,j=sm;i<=n;++i)

	{

		j-=b[i];

		modif(1,1,n,a[i],0,0);

		modif(1,1,n,a[i],-(1<<20),1);

		int x=c0+(a[i]>=mi0)-c1+j;

		bool o=0;

		if(quer(1,1,n,max(mi1,1),n,x&1)<x)

		{

			x=c1-(c0+(a[i]>=mi0))+j;

			o=x<0||quer(1,1,n,max(mi0,a[i]),n,x&1)<x;

		}

		if(o) an[i]=1,c1+=a[i]>=mi1,mi1=max(mi1,a[i]);

		else c0+=a[i]>=mi0,mi0=max(mi0,a[i]);

	}

	c0=c1=0;

	for(int i=1,mm0=0,mm1=0;i<=n;++i)

	{

		if(!an[i])

		{

			if(mm0<a[i]) mm0=a[i],++c0;

		}

		else

		{

			if(mm1<a[i]) mm1=a[i],++c1;

		}

	}

	if(c0!=c1) puts("-1");

	else for(int i=1;i<=n;++i) printf("%d",an[i]);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 4.184055585688102x):
#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 () { 

	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; 

}