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 lint;
typedef long double louble;
template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return b<a?a:b;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	char buf[bufl],*s=buf,*t=buf;
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0,b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 200007 , inf = 0x3f3f3f3f;

struct sgt
{
#define lc (x<<1)
#define rc (x<<1|1)
#define mid ((l+r)>>1)

	static const int _t = _<<2;

	int t[_t];

	void up(int x){t[x]=max(t[lc],t[rc]);}

	void plant(int x,int l,int r,int val)
	{
		t[x]=val;
		if(l==r)return;
		plant(lc,l,mid,val),plant(rc,mid+1,r,val),up(x);
	}

	void change(int x,int l,int r,int tar,int dlt)
	{
		if(l==r){t[x]=dlt;return;}
		if(tar<=mid)change(lc,l,mid,tar,dlt);
		else change(rc,mid+1,r,tar,dlt);
		up(x);
	}

	int finder(int x,int l,int r,int tl,int tr)
	{
		if(tl<=l && r<=tr)return t[x];
		if(tr<=mid)return finder(lc,l,mid,tl,tr);
		if(tl>mid)return finder(rc,mid+1,r,tl,tr);
		return max(finder(lc,l,mid,tl,tr),finder(rc,mid+1,r,tl,tr));
	}

#undef lc
#undef rc
#undef mid
}t0,t1;

int n,val[_],xval[_],sxval[_]={0},ans[_];

inline int able(int now,int amx,int acnt,int bmx,int bcnt)
{
	int aval=acnt-bcnt+sxval[now],bval=bcnt-acnt+sxval[now];
	if(aval>=0 && (aval&1?t1:t0).finder(1,1,n,bmx,n)>=aval)return 1;
	if(bval>=0 && (bval&1?t1:t0).finder(1,1,n,amx,n)>=bval)return 1;
	return 0;
}

int main()
{
	n=ty();
	for(int i=1,a=0;i<=n;i++)val[i]=ty(),xval[i]=(val[i]>a),a=max(a,val[i]);
	for(int i=n;i>=1;i--)sxval[i]=sxval[i+1]+xval[i];
	
	t0.plant(1,1,n,0),t1.plant(1,1,n,-inf);
	for(int i=n;i>=1;i--)
	{
		int a=t0.finder(1,1,n,val[i],n),b=t1.finder(1,1,n,val[i],n);
		if(xval[i])a+=2,b+=2;
		else swap(a,b),a++,b++;
		t0.change(1,1,n,val[i],a),t1.change(1,1,n,val[i],b);
	}

	int amx=1,bmx=1,acnt=0,bcnt=0;
	for(int i=1;i<=n;i++)
	{
		t0.change(1,1,n,val[i],0),t1.change(1,1,n,val[i],-inf);
		if(able(i+1,max(amx,val[i]),acnt+(amx<=val[i]),bmx,bcnt))
			acnt+=amx<=val[i],amx=max(amx,val[i]),ans[i]=0;
		else bcnt+=bmx<=val[i],bmx=max(bmx,val[i]),ans[i]=1;
	}

	if(acnt!=bcnt){puts("-1");return 0;}
	for(int i=1;i<=n;i++)putchar(ans[i]+'0');
	puts("");

	return 0;
}