#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
inline void myassert(bool a, string s) {
  if (!a) cerr << s << endl, exit(0);
}
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return ~f ? s : -s;
}
const int maxn = 3e5 + 20;
int n;
long long t[maxn];
int c[maxn];
inline void init() {
  n = read();
  for (int i = (1), _end_ = (n); i <= _end_; i++) scanf("%lld", t + i);
  reverse(t + 1, t + n + 1);
  int flg = 1;
  for (int i = (1), _end_ = (n); i <= _end_; i++) flg &= t[i] <= 1;
  if (flg) {
    for (int i = (1), _end_ = (n); i <= _end_; i++) printf("%d", 0);
    exit(0);
  }
}
inline long long check(long long l, long long r, long long s) {
  if (s < 0) return -1;
  if (!s) return 0;
  if (l > r) return -1;
  long long L = 0, R = r - l + 1;
  while (L < R) {
    long long mid = L + R + 1 >> 1;
    if ((l + l + mid - 1) * mid <= s * 2)
      L = mid;
    else
      R = mid - 1;
  }
  return (r + r - L + 1) * L >= s * 2 ? L : -1;
}
inline void Set(long long l, long long r, long long s) {
  long long num = check(l, r, s);
  if (num == -1) myassert(0, "Set 1 gg");
  while (num) {
    num--;
    if (num == 0)
      c[s] = 1;
    else {
      long long L = (l + l + num - 1) * num >> 1,
                R = (r + r - num + 1) * num >> 1;
      if (s - r >= L)
        c[r] = 1, s -= r, r--;
      else if (s - l <= R)
        c[l] = 1, s -= l, l++;
      else
        myassert(0, "Set 2 gg");
    }
  }
}
struct node {
  bool ext;
  long long pos, val;
  node() {}
  node(long long a, long long b) {
    ext = 1;
    pos = a;
    val = b;
  }
};
node f[maxn][2];
inline void doing() {
  static pair<int, int> st[maxn];
  int top = 0;
  for (int i = (n), _end_ = (1); i >= _end_; i--)
    if (t[i]) {
      if (top && t[st[top].second] >= t[i])
        st[top].first = i;
      else
        st[++top] = make_pair(i, i);
    }
  reverse(st + 1, st + top + 1);
  st[1].first = 1;
  st[top + 1] = make_pair(n + 1, n + 1);
  f[top + 1][0] = node(n + 1, 0);
  st[0] = make_pair(0, 0);
  for (int i = (top), _end_ = (1); i >= _end_; i--) {
    int l = st[i].first, r = st[i].second;
    if (st[i].first > 1) {
      if (l < r) {
        if (t[l] == t[r]) {
          for (int j = (l - 1), _end_ = (st[i - 1].second + 1); j >= _end_;
               j--) {
            int flg = 1;
            for (int op = (0), _end_ = (1); op <= _end_; op++)
              if (f[i + 1][op].ext) {
                node p = f[i + 1][op];
                long long nv = t[l] - 1;
                if (~check(r + 1, p.pos - 1, nv - j - p.val)) {
                  f[i][0] = node(j, nv);
                  flg = 0;
                }
              }
            if (!flg) break;
          }
        } else {
          for (int op = (0), _end_ = (1); op <= _end_; op++)
            if (f[i + 1][op].ext) {
              node p = f[i + 1][op];
              long long nv = t[l];
              if (~check(r + 1, p.pos - 1, nv - l - p.val)) {
                f[i][0] = node(l, nv);
              }
            }
        }
      } else {
        for (int j = (l - 1), _end_ = (st[i - 1].second + 1); j >= _end_; j--) {
          int flg = 1;
          for (int op = (0), _end_ = (1); op <= _end_; op++)
            if (f[i + 1][op].ext) {
              node p = f[i + 1][op];
              long long nv = t[l] - 1;
              if (~check(r + 1, p.pos - 1, nv - j - p.val)) {
                f[i][0] = node(j, nv);
                flg = 0;
              }
            }
          if (!flg) break;
        }
        for (int op = (0), _end_ = (1); op <= _end_; op++)
          if (f[i + 1][op].ext) {
            node p = f[i + 1][op];
            long long nv = t[l];
            if (~check(r + 1, p.pos - 1, nv - l - p.val)) {
              f[i][1] = node(l, nv);
            }
          }
      }
    } else {
      long long mn = 1ll << 60, mx = 0;
      int id = 0;
      for (int j = (l), _end_ = (r); j <= _end_; j++)
        if (t[j]) chkmin(mn, t[j]), chkmax(mx, t[j]);
      if (l == r) mx = mn + 1;
      if (mn < mx)
        for (int j = (l), _end_ = (r); j <= _end_; j++)
          if (t[j] == mn) {
            id = j;
            break;
          }
      for (int j = (0), _end_ = (r); j <= _end_; j++)
        if ((id == 0 && !t[j]) || id == j) {
          for (int op = (0), _end_ = (1); op <= _end_; op++)
            if (f[i + 1][op].ext) {
              node p = f[i + 1][op];
              long long nv = mx - 1;
              if (~check(r + 1, p.pos - 1, nv - j - p.val)) {
                f[i][0] = node(j, nv);
              }
            }
        }
    }
  }
  long long pos, val;
  for (int op = (0), _end_ = (1); op <= _end_; op++)
    if (f[1][op].ext) pos = f[1][op].pos, val = f[1][op].val;
  for (int i = (1), _end_ = (top); i <= _end_; i++) {
    int l = st[i].first, r = st[i].second;
    c[pos] = 1;
    int flg = 0;
    for (int op = (0), _end_ = (1); op <= _end_; op++)
      if (f[i + 1][op].ext) {
        node p = f[i + 1][op];
        if (~check(r + 1, p.pos - 1, val - p.val - pos)) {
          Set(r + 1, p.pos - 1, val - p.val - pos);
          pos = p.pos;
          val = p.val;
          flg = 1;
          break;
        }
      }
    if (!flg) myassert(0, "wrong while constructing ");
  }
  for (int i = (n), _end_ = (1); i >= _end_; i--) printf("%d", c[i]);
}
int main() {
  init();
  doing();
  return 0;
}
