#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
struct node {
  int l, r, co;
  long long v;
} q[N];
long long t[N], a[N];
int n, tot, vis[N], nx[N];
int f[N][2], co[N];
int fr[N][2][2];
void init_node() {
  tot = 0;
  memcpy(t, a, sizeof(t));
  memset(vis, 0, sizeof(vis));
  for (int i = (int)(1); i <= (int)(n); i++) co[i] = -1;
  int lap = 0;
  for (int i = (int)(1); i <= (int)(n); i++)
    if (t[i]) {
      if (lap && t[i] <= t[lap]) {
        for (int j = (int)(lap); j <= (int)(i - 1); j++)
          t[j] = t[lap], co[j] = 0;
        co[i] = (t[i] == t[lap] ? 0 : 1);
      }
      lap = i;
    }
  q[++tot] = (node){0, 0, 1, 0};
  for (int i = (int)(1); i <= (int)(n); i++)
    if (t[i] && !vis[i]) {
      int j = i;
      for (; j < n && t[j + 1] && t[j + 1] <= t[j]; ++j)
        ;
      for (int p = (int)(i); p <= (int)(j); p++) vis[p] = 1;
      if (i == j)
        q[++tot] = (node){i, j, -1, t[j]};
      else
        q[++tot] = (node){i, j, co[j], t[j]};
    }
}
int CO(int x) { return n + 1 - x; }
void update1(int i, int j, int v1, long long v2) {
  if (q[i + 1].co == 0) return;
  int l = v1, r = q[i + 1].l - 1;
  l = CO(l);
  r = CO(r);
  swap(l, r);
  v2 = q[i + 1].v - CO(q[i + 1].r) - v2;
  if (r + 1 < l) return;
  for (int ele = (int)(0); ele <= (int)(r - l + 1); ele++) {
    long long sl = 1ll * ele * (l + l + ele - 1) / 2;
    long long sr = 1ll * ele * (r + r - ele + 1) / 2;
    if (sl <= v2 && v2 <= sr) {
      f[i + 1][1] = 1;
      fr[i + 1][1][0] = j;
      fr[i + 1][1][1] = ele;
    }
  }
}
void update2(int i, int j, int v1, long long v2) {
  if (q[i + 1].co != 0) return;
  int l = v1, r = q[i + 1].l - 1;
  l = CO(l);
  r = CO(r);
  swap(l, r);
  v2 = q[i + 1].v - 1 - CO(q[i + 1].l) - v2;
  if (r + 1 < l) return;
  for (int ele = (int)(0); ele <= (int)(r - l + 1); ele++) {
    long long sl = 1ll * ele * (l + l + ele - 1) / 2;
    long long sr = 1ll * ele * (r + r - ele + 1) / 2;
    if (sr >= v2) {
      long long at = q[i + 1].l + max(0ll, sl - v2);
      if (at >= n + 1) continue;
      if (nx[at] > q[i + 1].l + sr - v2) continue;
      f[i + 1][1] = 1;
      fr[i + 1][1][0] = nx[at];
      fr[i + 1][1][1] = ele;
    }
  }
}
void update0(int i, int j, int v1, long long v2) {
  if (q[i + 1].co == 1) return;
  int l = v1, r = q[i + 1].l - 1;
  l = n + 1 - l;
  r = n + 1 - r;
  swap(l, r);
  v2 = q[i + 1].v - 1 - CO(q[i + 1].r + 1) - v2;
  if (r + 1 < l) return;
  for (int ele = (int)(0); ele <= (int)(r - l + 1); ele++) {
    long long sl = 1ll * ele * (l + l + ele - 1) / 2;
    long long sr = 1ll * ele * (r + r - ele + 1) / 2;
    if (sr >= v2) {
      long long at = q[i + 1].r + 1 + max(0ll, sl - v2);
      if (at < f[i + 1][0]) {
        f[i + 1][0] = at;
        fr[i + 1][0][0] = j;
        fr[i + 1][0][1] = ele;
      }
    }
  }
}
void construct1(int i, int j, long long v1, long long v2, int ele) {
  assert(q[i + 1].co != 0);
  int l = v1, r = q[i + 1].l - 1;
  l = CO(l);
  r = CO(r);
  swap(l, r);
  v2 = q[i + 1].v - CO(q[i + 1].r) - v2;
  co[q[i + 1].r] = 1;
  if (r < l) r = l - 1;
  for (int i = (int)(l); i <= (int)(r); i++)
    if (ele) {
      long long tmp = v2 - i;
      long long sl = 1ll * (ele - 1) * ((i + 1) + (i + 1) + (ele - 1) - 1) / 2;
      long long sr = 1ll * (ele - 1) * (r + r - (ele - 1) + 1) / 2;
      if (sl <= tmp && tmp <= sr) co[CO(i)] = 1, v2 -= i, ele--;
    }
  assert(!ele);
}
void construct0(int i, int j, long long v1, long long v2, int ele) {
  assert(q[i + 1].co != 1);
  int l = v1, r = q[i + 1].l - 1;
  l = CO(l);
  r = CO(r);
  swap(l, r);
  v2 = q[i + 1].v - 1 - CO(f[i + 1][0]) - v2;
  co[f[i + 1][0]] = 1;
  if (r < l) r = l - 1;
  for (int i = (int)(l); i <= (int)(r); i++)
    if (ele) {
      long long tmp = v2 - i;
      long long sl = 1ll * (ele - 1) * ((i + 1) + (i + 1) + (ele - 1) - 1) / 2;
      long long sr = 1ll * (ele - 1) * (r + r - (ele - 1) + 1) / 2;
      if (sl <= tmp && tmp <= sr) co[CO(i)] = 1, v2 -= i, ele--;
    }
  assert(!ele);
}
void construct(int i, int p) {
  if (i == 1) return;
  int j = fr[i][p][0];
  construct(i - 1, j);
  long long v1 = (j == 0 ? f[i - 1][j] + 1 : q[i - 1].r + 1);
  long long v2 = (j == 0 ? q[i - 1].v - 1 : q[i - 1].v);
  if (p == 0)
    construct0(i - 1, j, v1, v2, fr[i][p][1]);
  else
    construct1(i - 1, j, v1, v2, fr[i][p][1]);
}
void find_solu() {
  memset(f, 30, sizeof(f));
  f[1][1] = 1;
  for (int i = (int)(1); i <= (int)(tot - 1); i++)
    for (int j = (int)(0); j <= (int)(1); j++) {
      if (f[i][j] >= n + 1) continue;
      long long v1 = (j == 0 ? f[i][j] + 1 : q[i].r + 1);
      long long v2 = (j == 0 ? q[i].v - 1 : q[i].v);
      update0(i, j, v1, v2);
      update1(i, j, v1, v2);
    }
  if (f[tot][0] > n + 1 && f[tot][1] > n + 1) return;
  construct(tot, f[tot][1] <= n + 1);
  for (int i = (int)(1); i <= (int)(n); i++)
    if (co[i] == -1) co[i] = 0;
  for (int i = (int)(1); i <= (int)(n); i++) printf("%d", co[i]);
  exit(0);
}
void find_solu2() {
  nx[n + 1] = n + 1;
  assert(q[tot].r != q[tot].l);
  for (int i = (int)(q[tot].l); i <= (int)(q[tot].r); i++)
    if (!a[i]) nx[i] = i;
  for (int i = (int)(n); i >= (int)(1); i--)
    if (!nx[i]) nx[i] = nx[i + 1];
  for (int i = (int)(tot - 1); i <= (int)(tot - 1); i++)
    for (int j = (int)(0); j <= (int)(1); j++) {
      if (f[i][j] >= n + 1) continue;
      long long v1 = (j == 0 ? f[i][j] + 1 : q[i].r + 1);
      long long v2 = (j == 0 ? q[i].v - 1 : q[i].v);
      update2(i, j, v1, v2);
    }
  if (f[tot][1] > n + 1) return;
  q[tot].r = fr[tot][1][0];
  q[tot].co = 1;
  q[tot].v--;
  find_solu();
  exit(0);
}
int main() {
  long long mxv = 0;
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%lld", &a[i]);
  for (int i = (int)(1); i <= (int)(n); i++) mxv = max(mxv, a[i]);
  if (!mxv) {
    for (int i = (int)(1); i <= (int)(n); i++) putchar('0');
    puts("");
    return 0;
  }
  init_node();
  find_solu();
  find_solu2();
  assert(0);
}
