Problem: You are given P, a permutation of (1,\ 2,\ ...\ N).

A string S of length N consisting of `0` and `1` is a good string when it meets the following criterion:

* The sequences X and Y are constructed as follows:
* First, let X and Y be empty sequences.
* For each i=1,\ 2,\ ...\ N, in this order, append P_i to the end of X if S_i= `0`, and append it to the end of Y if S_i= `1`.
* If X and Y have the same number of high elements, S is a good string. Here, the i-th element of a sequence is called high when that element is the largest among the elements from the 1-st to i-th element in the sequence.



Determine if there exists a good string. If it exists, find the lexicographically smallest such string.

Constraints

* 1 \leq N \leq 2 \times 10^5
* 1 \leq P_i \leq N
* P_1,\ P_2,\ ...\ P_N are all distinct.
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
P_1 P_2 ... P_N


Output

If a good string does not exist, print `-1`. If it exists, print the lexicographically smallest such string.

Examples

Input

6
3 1 4 6 2 5


Output

001001


Input

5
1 2 3 4 5


Output

-1


Input

7
1 3 2 5 6 4 7


Output

0001101


Input

30
1 2 6 3 5 7 9 8 11 12 10 13 16 23 15 18 14 24 22 26 19 21 28 17 4 27 29 25 20 30


Output

000000000001100101010010011101

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<int>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define mem(a) memset((a),0,sizeof(a))
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
const int N=200005,M=N<<2,inf=1e9;
int Q,p[N],mx,c[N],zs[2];
char ans[N];
struct seg{
	int tr[M];
	void ins(int l,int r,int pos,int de,int nod){
		if(l==r){
			tr[nod]=de; return;
		}
		int mid=(l+r)>>1;
		if(pos<=mid)ins(l,mid,pos,de,nod<<1); else ins(mid+1,r,pos,de,nod<<1|1);
		tr[nod]=max(tr[nod<<1],tr[nod<<1|1]);
	}
	int ask(int l,int r,int pos,int nod){
		if(pos<=l)return tr[nod];
		if(pos>r)return -inf;
		int mid=(l+r)>>1;
		return max(ask(l,mid,pos,nod<<1),ask(mid+1,r,pos,nod<<1|1));
	}
}T[2];
int main(){
	int n=read();
	For(i,1,n){
		p[i]=read(); mx=max(mx,p[i]); 
		c[i]=(p[i]==mx)+1; Q+=p[i]==mx;
	}
	For(i,0,M-1)T[1].tr[i]=-1e9;
	Rep(i,n,1){
		For(j,0,1){
			zs[j]=T[j^(c[i]&1)].ask(1,n,p[i],1)+c[i];
		}
	//	cout<<c[i]<<" "<<zs[1]<<endl;
		For(j,0,1)T[j].ins(1,n,p[i],zs[j],1);
	}
	//string ans=min(solve1(),solve2());
	int cx=0,cy=0,hx=1,hy=1;  //cout<<Q<<" "<<T[1].ask(1,n,1,1)<<endl;
	if(T[(cy+Q-cx)&1].ask(1,n,1,1)<cy+Q-cx){
		puts("-1"); return 0;
	}
	For(i,1,n){
		Q-=c[i]-1;
		For(j,0,1)T[j].ins(1,n,p[i],j?-inf:0,1);
		int CX=cx,CY=cy,HX=hx,HY=hy;
		HX=max(HX,p[i]);
		CX+=HX==p[i];
		//if(i==14)cout<<CX<<" "<<CY<<" "<<HX<<" "<<Q-CX+CY<<" "<<CX+Q-CY<<" "<<T[(CX+Q-CY)&1].ask(1,n,HY,1)<<endl;
		if(CY+Q-CX>=0&&T[(CY+Q-CX)&1].ask(1,n,HX,1)>=CY+Q-CX){
			cx=CX; hx=HX;
			ans[i]='0';
		}else if(CX+Q-CY>=0&&T[(CX+Q-CY)&1].ask(1,n,HY,1)>=CX+Q-CY){
			cx=CX; hx=HX;
			ans[i]='0';
		}else{
			hy=max(hy,p[i]);
			cy+=hy==p[i];
			ans[i]='1';
		}
	}
	cout<<(ans+1)<<endl;
}