// 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.19184165142361x):
#include<bits/stdc++.h>

using namespace std;



const int N=2e5+100,inf=2e7;

int n,p[N],f[2][N],s[N],c[N],cnt1,cnt2,mx1,mx2;

char Ans[N];



struct SegmentTree

{

	#define Mx N<<2

	#define ls k<<1

	#define rs k<<1|1

	int L[Mx],R[Mx],mx[Mx];

	void build(int k,int l,int r)

	{

		L[k]=l, R[k]=r, mx[k]=-inf;

		if(l == r) return;

		int mid=(l+r)>>1;

		build(ls,l,mid), build(rs,mid+1,r);

	}

	void Modify(int k,int x,int sum)

	{

		//cout<<L[k]<<" "<<R[k]<<" "<<x<<" "<<sum<<endl;

		if(L[k] == R[k]) {mx[k]=sum; return;}

		int mid=(L[k]+R[k])>>1;

		if(x<=mid) Modify(ls,x,sum);

		else Modify(rs,x,sum);

		mx[k]=max(mx[ls],mx[rs]);

	}

	int Query(int k,int l,int r)

	{	

		if(l<=L[k] && R[k]<=r) return mx[k];

		int mid=(L[k]+R[k])>>1,ret=-inf;

		if(l<=mid) ret=max(ret,Query(ls,l,r));

		if(r>mid) ret=max(ret,Query(rs,l,r));

		return ret;

	}

}Tr[2];

bool chk(int MX,int Q)

{

	if(Q<0) return 0;

	//cout<<MX<<" "<<Q<<" "<<Tr[1].Query(1,max(1,MX),n)<<endl;

	if(Q&1) return Tr[1].Query(1,max(1,MX),n)>=Q;

	return Tr[0].Query(1,max(1,MX),n)>=Q;

}

int main()

{

	scanf("%d",&n);

	for(int i=1;i<=n;++i)

		scanf("%d",&p[i]), s[i]=max(p[i],s[i-1]),

		c[i] = (s[i] == p[i])?2:1;

	//for(int i=1;i<=n;++i) cout<<c[i]<<" "; puts("");

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

	{

		s[i]=s[i+1];

		if(c[i] == 2) ++s[i];

	}

	Tr[0].build(1,1,n), Tr[1].build(1,1,n);

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

	{

		f[0][i]=(c[i] == 2)?2:-inf, f[1][i]=(c[i] == 1)?1:-inf;

		if(c[i] == 2)

			f[0][i]=max(Tr[0].Query(1,p[i],n)+2,f[0][i]),

			f[1][i]=max(Tr[1].Query(1,p[i],n)+2,f[1][i]);

		else

			f[0][i]=max(Tr[1].Query(1,p[i],n)+1,f[0][i]),

			f[1][i]=max(Tr[0].Query(1,p[i],n)+1,f[1][i]);

		Tr[0].Modify(1,p[i],f[0][i]), Tr[1].Modify(1,p[i],f[1][i]);

		

	}

	for(int i=1;i<=n;++i)

	{

		Tr[0].Modify(1,p[i],0), Tr[1].Modify(1,p[i],-inf);

		//cout<<f[0][i]<<" "<<f[1][i]<<" "<<Tr[1].Query(1,1,n)<<endl;

		int c1=cnt1, c2=cnt2;

	//放在X后

		c1=(p[i]>mx1)?c1+1:c1;

		if(chk(mx2,c1-c2+s[i+1]))

		{

			Ans[i]='0', cnt1=c1, mx1=max(p[i],mx1); continue;

		}

		if(chk(max(p[i],mx1),c2-c1+s[i+1]))

		{

			Ans[i]='0', cnt1=c1, mx1=max(p[i],mx1); continue;

		}

	//放在Y后

		c1=cnt1, c2=(mx2<p[i])?c2+1:c2;

		Ans[i]='1', cnt2=c2, mx2=max(mx2,p[i]);

	}

	if(cnt1 != cnt2) {puts("-1"); return 0;}

	puts(Ans+1);

	return 0;

}