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;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const int N = 200010, INF = 0x3f3f3f3f;
int val[N], n, dp[N][2], tp[N], num, ans[N];
struct segt {
  int mx[N << 2];
  void setval(int p,int v,int x=1,int lp=1,int rp=n) {
    if (lp == rp) {
      mx[x] = v;
      return;
    }
    int mid = (lp + rp) >> 1;
    if (p <= mid) setval(p, v, x<<1, lp, mid);
    else setval(p, v, x<<1|1, mid+1, rp);
    mx[x] = max(mx[x<<1], mx[x<<1|1]);
  }
  int query(int l,int r,int x=1,int lp=1,int rp=n) {
    if (l > rp || lp > r) return -INF;
    if (lp >= l && rp <= r) return mx[x];
    int mid = (lp + rp) >> 1;
    return max(query(l, r, x<<1, lp, mid), query(l, r, x<<1|1, mid+1, rp));
  }
} t[2];
bool check(int v,int l) {
  if (v < 0) return false;
  if (v == 0) return true;
  if (v % 2 == 0)
    return t[0].query(l, n) >= v;
  else
    return t[1].query(l, n) >= v;
}
int main() {
  read(n);
  rep (i, 1, n) read(val[i]);
  for (int i = 1, j = 0; i <= n; ++ i) {
    if (val[i] > j) tp[i] = 2, j = val[i], ++ num;
    else tp[i] = 1;
  }
  rep (i, 1, n) t[0].setval(i, -INF), t[1].setval(i, -INF);
  rrp (i, n, 1) {
    dp[i][0] = max(0, t[0].query(val[i]+1, n)) + tp[i];
    dp[i][1] = t[1].query(val[i]+1, n) + tp[i];
    if (tp[i] == 1) dp[i][1] = max(dp[i][1], dp[i][0]);
    t[0].setval(val[i], dp[i][0]);
    t[1].setval(val[i], dp[i][1]);
  }
  if (!check(num, 1)) {
    puts("-1");
    return 0;
  }
  // v0 - v1 + num = 2k1 + m1
  int mx0 = 0, mx1 = 0, v0 = 0, v1 = 0;
  rep (i, 1, n) {
    t[0].setval(val[i], -INF);
    t[1].setval(val[i], -INF);
    num -= (tp[i] - 1);
    int c0 = v0, c1 = v1;
    if (val[i] > mx0) ++ c0;
    if (!check(c1 - c0 + num, max(mx0, val[i])+1) && !check(c0 - c1 + num, mx1+1)) {
      ans[i] = 1;
      v1 += (val[i] > mx1);
      mx1 = max(mx1, val[i]);
    } else {
      ans[i] = 0;
      v0 += (val[i] > mx0);
      mx0 = max(mx0, val[i]);
    }
  }
  rep (i, 1, n) printf("%d", ans[i]);
  puts("");
  return 0;
}