//Zory-2019
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<vector>
#include<algorithm>
#include<iostream>
#include<deque>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define double long double
	const int INF=0x3f3f3f3f;
	const ll LLINF=0x3f3f3f3f3f3f3f3fll;
	ll qread()
	{
		ll ans=0;char c=getchar();int f=1;
		while(c<'0' or c>'9') {if(c=='-') f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) {num=-num;putchar('-');}
		if(num>9) write(num/10);
		putchar('0'+num%10);
	}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);puts("");}
	#define FR first
	#define SE second
	#define MP make_pair
	#define pr pair<int,int>
	#define PB push_back
	#define vc vector
	void chmax(int &x,const int y) {x=x>y?x:y;}
	void chmin(int &x,const int y) {x=x<y?x:y;}
	const int MAX_N=2e5+10;
	const ll MOD=1e9+7;
	void add(int &x,int y){x+=y;if(x>=MOD) x-=MOD;if(x<0) x+=MOD;}
	
	struct BIT
	{
		vc<int> bit[MAX_N];int now[MAX_N];BIT(){memset(now,0,sizeof now);}
		#define lowbit(x) ((x)&-(x))
		void change(int x,int c){while(x<MAX_N) bit[x].PB(max(bit[x][now[x]],c)),now[x]++,x+=lowbit(x);}
		int ask(int x){int ans=-INF;while(x>=1) chmax(ans,bit[x][now[x]]),x-=lowbit(x);return ans;}
		void gaygay(int x){while(x<MAX_N) now[x]--,x+=lowbit(x);}
	}bit[2];
	int a[MAX_N];vc<int> ans;
	int c[2],mi[2],cnt[MAX_N];
	bool check(int i,int now)
	{
		int tmp1=c[now],tmp2=mi[now];
		if(a[i]<mi[now]) c[now]++,mi[now]=a[i];
		//printf("i=%d now=%d\n",i,now);
		for(int j=0;j<=1;j++)
		{
			int wt=c[j]-c[j^1]+cnt[i+1];if(wt<0) continue;
			//printf("mi2=%d j=%d wt=%d 0=%d 1=%d\n",mi[j^1],j,wt,bit[0].ask(mi[j^1]),bit[1].ask(mi[j^1]));
			if(bit[wt&1].ask(mi[j^1])>=wt) return 1;
		}
		c[now]=tmp1;mi[now]=tmp2;
		return 0;
	}
	void main()
	{
		for(int i=1;i<MAX_N;i++) bit[0].bit[i].PB(0);
		for(int i=1;i<MAX_N;i++) bit[1].bit[i].PB(-1);
		
		int n=qread();for(int i=1;i<=n;i++) a[i]=n-qread()+1;
		int lstmi=INF;for(int i=1;i<=n;i++) if(a[i]<lstmi) lstmi=a[i],cnt[i]=1; else cnt[i]=0;
		for(int i=n;i>=1;i--) cnt[i]+=cnt[i+1];
		
		for(int i=n;i>=1;i--)
		{
			int t0=bit[0].ask(a[i]),t1=bit[1].ask(a[i]);if(t1==-1) t1=-INF;
			
			//if(i==2)
			//		puts("");
			
			t0+=1+(cnt[i]-cnt[i+1]);t1+=1+(cnt[i]-cnt[i+1]);
			if((t0&1)==(t1&1)) bit[t1&1].change(a[i],max(t0,t1)),bit[(t1&1)^1].change(a[i],-INF);
			else bit[t0&1].change(a[i],t0),bit[t1&1].change(a[i],t1);
		}
		mi[0]=mi[1]=n+1;
		for(int i=1;i<=n;i++)
		{
			bit[0].gaygay(a[i]);bit[1].gaygay(a[i]);
			
			if(check(i,0)) ans.PB(0);
			else
			{
				if(i>1){if(a[i]<mi[1]) c[1]++,mi[1]=a[i];}
				else if(!check(i,1)) {puts("-1");return;}
				ans.PB(1);//printf("pos[%d]=1\n",i);
			}
			//else if(check(i,1)) ans.PB(1);
			//else {puts("-1");return;}
		}
		for(int t=0;t<n;t++) putchar('0'+ans[t]);
	}
};
signed main()
{
	srand(time(0));
	mine::main();
}
