#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template <typename T,typename E>
struct SegmentTree{
  using F = function<T(T,T)>;
  using G = function<T(T,E)>;
  using H = function<E(E,E)>;
  Int n,height;
  F f;
  G g;
  H h;
  T ti;
  E ei;
  vector<T> dat;
  vector<E> laz;
  SegmentTree(F f,G g,H h,T ti,E ei):
    f(f),g(g),h(h),ti(ti),ei(ei){}
  
  void init(Int n_){
    n=1;height=0;
    while(n<n_) n<<=1,height++;
    dat.assign(2*n,ti);
    laz.assign(2*n,ei);
  }
  void build(const vector<T> &v){
    Int n_=v.size();
    init(n_);
    for(Int i=0;i<n_;i++) dat[n+i]=v[i];
    for(Int i=n-1;i;i--)
      dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
  }
  inline T reflect(Int k){
    return laz[k]==ei?dat[k]:g(dat[k],laz[k]);
  }
  inline void eval(Int k){
    if(laz[k]==ei) return;
    laz[(k<<1)|0]=h(laz[(k<<1)|0],laz[k]);
    laz[(k<<1)|1]=h(laz[(k<<1)|1],laz[k]);
    dat[k]=reflect(k);
    laz[k]=ei;
  }
  inline void thrust(Int k){
    for(Int i=height;i;i--) eval(k>>i);
  }
  inline void recalc(Int k){    
    while(k>>=1)
      dat[k]=f(reflect((k<<1)|0),reflect((k<<1)|1));
  }
  void update(Int a,Int b,E x){
    thrust(a+=n);
    thrust(b+=n-1);
    for(Int l=a,r=b+1;l<r;l>>=1,r>>=1){
      if(l&1) laz[l]=h(laz[l],x),l++;
      if(r&1) --r,laz[r]=h(laz[r],x);
    }
    recalc(a);
    recalc(b);
  }
  void set_val(Int a,T x){
    thrust(a+=n);
    dat[a]=x;laz[a]=ei;
    recalc(a);
  }
  T query(Int a,Int b){
    thrust(a+=n);
    thrust(b+=n-1);
    T vl=ti,vr=ti;
    for(Int l=a,r=b+1;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,reflect(l++));
      if(r&1) vr=f(reflect(--r),vr);
    }
    return f(vl,vr);
  }
};


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> p(n);
  for(Int i=0;i<n;i++) cin>>p[i];

  vector<Int> latte(n);
  for(Int i=0,t=0;i<n;i++){
    latte[i]=(t<p[i]);
    chmax(t,p[i]);
  }

  Int k=0;
  for(Int i=0;i<n;i++) k+=latte[i];

  auto f=[](Int a,Int b){return max(a,b);};
  auto g=[](Int a,Int b){return a+b;};
  const Int INF = 1e9;
  SegmentTree<Int, Int> seg1(f,g,g,-INF,0);
  SegmentTree<Int, Int> seg2(f,g,g,-INF,0);

  vector<Int> vs(n+10,-INF);
  seg1.build(vs);
  seg2.build(vs);
 
  for(Int i=n-1;i>=0;i--){
    if(latte[i]){
      Int res1=seg1.query(p[i],n+10)+1;
      Int res2=seg2.query(p[i],n+10)+1;
      chmax(res1,1);
      
      seg1.update(0,n+10,-1);
      seg2.update(0,n+10,-1);
      
      seg1.set_val(p[i],res1);
      seg2.set_val(p[i],res2);
    }else{
      Int res1=seg1.query(p[i],n+10)+1;
      Int res2=seg2.query(p[i],n+10)+1;
      chmax(res1,1);
      
      seg2.set_val(p[i],max(res1,res2));
    }
  }
  
  Int a=0,b=0,c=0,d=0,e=0;
  //cout<<k<<":"<<seg1.query(0,n+10)<<endl;
  //cout<<seg2.query(0,n+10)<<endl;
  
  auto check1=
    [&](){return min(a,b)+(k-c)>=max(a,b)&&(a+b+(k-c))%2==0;};
  auto check2=
    [&](Int d,Int e){
      //cout<<"d:"<<d<<" "<<seg2.query(d+1,n+10)<<endl;
      //cout<<"e:"<<e<<" "<<seg2.query(e+1,n+10)<<endl;
      
      if(a+max(c==k?0LL:-INF,seg2.query(d+1,n+10))>=b&&
         b+max(k-c,seg2.query(e+1,n+10))>=a) return true;
      
      if(b+max(c==k?0LL:-INF,seg2.query(e+1,n+10))>=a&&
         a+max(k-c,seg2.query(d+1,n+10))>=b) return true;
      
      return false;
    };
  
  if(!check1()&&!check2(d,e)){
    cout<<-1<<endl;
    return 0;
  }

  string s(n,'$');
  for(Int i=0;i<n;i++){        
    if(latte[i]){
      seg1.update(0,n+10,1);
      seg2.update(0,n+10,1);
      
      seg1.set_val(p[i],-INF);
      seg2.set_val(p[i],-INF);
    }else{
      seg2.set_val(p[i],-INF);
    }
    if(latte[i]) c++;
    Int pa=a,pb=b,pd=d,pe=e,flg=0;
    {
      a=pa;b=pb;d=pd;e=pe;
      s[i]='0';
      if(d<p[i]) a++;
      chmax(d,p[i]);
      flg|=(check1()||check2(d,e));
    }
    /*
      cout<<s<<endl;
      cout<<a<<" "<<b<<":"<<c<<":"<<d<<" "<<e<<endl;
      cout<<check1()<<" "<<check2(d,e)<<endl;
      cout<<endl;
    */
    if(flg==0){
      a=pa;b=pb;d=pd;e=pe;
      s[i]='1';
      if(e<p[i]) b++;
      chmax(e,p[i]);
    }
    /*
      cout<<s<<endl;
      cout<<a<<" "<<b<<":"<<c<<":"<<d<<" "<<e<<endl;
      cout<<check1()<<" "<<check2(d,e)<<endl;
      cout<<endl;
    */
    assert(check1()||check2(d,e));
  }
  
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 21760