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

#define mp make_pair

#define pb push_back

#define fi first

#define se second

#define sz(a) int(a.size())

#define clr(a) memset(a,0,sizeof(a))

#define all(a) a.begin(),a.end()

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef long double ld;

typedef pair<int,int> pii;

typedef pair<ll,int> pli;

const int inf=1e9;

const ll Inf=1e18;

const int N=2e5+10;

const int mod=0;

int gi() {

    int x=0,o=1;char ch=getchar();

    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();

    if(ch=='-') o=-1,ch=getchar();

    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();

    return x*o;

}

template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };

template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };

int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }

int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }

void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }

void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }

int n,mx=0,Q=0,vis[N],p[N],tr[2][N<<2],ans[N];

#define ls (o<<1)

#define rs (o<<1|1)

void modify(int o,int l,int r,int p,int f0,int f1) {

    if(l==r) { tr[0][o]=f0,tr[1][o]=f1;return; }

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

    if(p<=mid) modify(ls,l,mid,p,f0,f1);

    else modify(rs,mid+1,r,p,f0,f1);

    for(int i=0;i<2;i++) tr[i][o]=max(tr[i][ls],tr[i][rs]);

}

int query(int k,int o,int l,int r,int p) {

    if(l==r) return tr[k][o];

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

    if(p<=mid) return max(query(k,ls,l,mid,p),tr[k][rs]);

    else return query(k,rs,mid+1,r,p);

}

int check(int Hx,int Hy,int Cx,int Cy) {

    int t=Cx-Cy+Q;

    if(t>=0) {

        int mx=query(t&1,1,1,n,Hy);

        if(mx>=t) return 1;

    }

    t=Cy-Cx+Q;

    if(t>=0) {

        int mx=query(t&1,1,1,n,Hx);

        if(mx>=t) return 1;

    }

    return 0;

}

int main() {

    n=gi();

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

        p[i]=gi();

        chkmax(mx,p[i]);

        if(mx==p[i]) vis[i]=1,++Q;

    }

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

        int f0=0,f1=0,t=query(0,1,1,n,p[i]);

        if(vis[i]) f0=t+2;

        else f1=t+1;

        t=query(1,1,1,n,p[i]);

        if(vis[i]) f1=t?t+2:0;

        else f0=t?t+1:0;

        modify(1,1,n,p[i],f0,f1);

    }

    int fl=1;

    int Hx=-inf,Hy=-inf,Cx=0,Cy=0;

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

        int _Hx=Hx,_Cx=Cx;

        if(vis[i]) --Q;

        modify(1,1,n,p[i],0,0);

        if(chkmax(Hx,p[i])) ++Cx;

        if(check(Hx,Hy,Cx,Cy)) continue;

        Hx=_Hx,Cx=_Cx,ans[i]=1;

        if(chkmax(Hy,p[i])) ++Cy;

        if(!check(Hx,Hy,Cx,Cy)) { fl=0;break; }

    }

    if(!fl) puts("-1");

    else {

        for(int i=1;i<=n;i++) putchar(ans[i]+'0');

    }

    return 0;

}