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:
//@winlere
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;  typedef long long ll;
inline int qr(){
	int ret=0,f=0,c=getchar();
	while(!isdigit(c)) f|=c==45,c=getchar();
	while( isdigit(c)) ret=ret*10+c-48,c=getchar();
	return f?-ret:ret;
}

const int maxn=2e5+5;
const int inf=0x3f3f3f3f;
struct SEG{
#define mid ((l+r)>>1)
#define lef l,mid,pos<<1
#define rgt mid+1,r,pos<<1|1
	int seg[maxn<<2];
	void upd(int p,int v,int l,int r,int pos){
		if(p<l||p>r) return;
		if(l==r) return seg[pos]=v,void();
		if(p<=mid) upd(p,v,lef);
		else upd(p,v,rgt);
		seg[pos]=max(seg[pos<<1],seg[pos<<1|1]);
	}
	int que(int L,int R,int l,int r,int pos){
		if(L>r||R<l) return -inf;
		if(L<=l&&r<=R) return seg[pos];
		return max(que(L,R,lef),que(L,R,rgt));
	}
	void init(){for(int t=0;t<maxn<<2;++t)seg[t]=-inf;}
#undef mid
#undef lef
#undef rgt
}d,s;
int n,data[maxn],val[maxn],Q[maxn],cntx,cnty,MaxX,MaxY;
char ans[maxn];

bool chek(int Max,int rhs){
	if(rhs<0) return 0;
	if(rhs&1) return d.que(Max,n,1,n,1)>=rhs;
	else return s.que(Max,n,1,n,1)>=rhs;
}

int main(){
	n=qr();
	for(int t=1;t<=n;++t) data[t]=qr();
	for(int t=1,Max=0;t<=n;++t){
		if(data[t]>Max) Max=data[t],val[t]=2;
		else val[t]=1;
	}
	for(int t=n;t;--t) Q[t]=Q[t+1]+val[t]-1;
	d.init();
	for(int t=n;t;--t){
		int t1=d.que(data[t],n,1,n,1),t2=s.que(data[t],n,1,n,1);
		if(val[t]==1) d.upd(data[t],t2+1,1,n,1),s.upd(data[t],t1+1,1,n,1);
		else d.upd(data[t],t1+2,1,n,1),s.upd(data[t],t2+2,1,n,1);
	}
	for(int t=1;t<=n;++t){
		d.upd(data[t],1-inf,1,n,1); s.upd(data[t],0,1,n,1);
		if(chek(MaxY,cntx-cnty+Q[t+1]+(data[t]>MaxX))) cntx+=data[t]>MaxX,MaxX=max(MaxX,data[t]),ans[t]='0';
		else if(chek(max(data[t],MaxX),cnty-cntx+Q[t+1]-(data[t]>MaxX))) cntx+=data[t]>MaxX,MaxX=max(MaxX,data[t]),ans[t]='0';
		else cnty+=data[t]>MaxY,ans[t]='1',MaxY=max(MaxY,data[t]);
	}
	if(cntx!=cnty) puts("-1");
	else puts(ans+1);
	return 0;
}