#include <bits/stdc++.h>
long long n, stk[200001], top, cnt, f[2][200001], g[2][200001], v[200001];
long long ans[200001];
long long t[200001];
std::vector<long long> vec[200001];
long long canget(long long l, long long r, long long S, long long x = -1) {
  if (!S && !~x) return 1;
  std::swap(l, r);
  l = n - l + 1, r = n - r + 1;
  long long ans = 0x7f7f7f7f;
  if (~x && n - S + 1 >= x) ans = n - S + 1;
  for (long long i = 1; i <= r - l + 1; i++) {
    long long mn = (i * (l + l + i - 1)) >> 1ll,
              mx = (i * (r + r - i + 1)) >> 1ll;
    if (!~x && mn <= S && mx >= S) return 1;
    if (~x && n + 1 - S + mx >= x)
      ans = std::min(ans, std::max(x, n + 1 - S + mn));
  }
  if (!~x)
    return 0;
  else
    return ans;
}
void get(long long l, long long r, long long S) {
  std::swap(l, r);
  l = n - l + 1, r = n - r + 1;
  for (long long i = 1; i <= r - l + 1; i++) {
    long long mn = (i * (l + l + i - 1)) >> 1ll,
              mx = (i * (r + r - i + 1)) >> 1ll;
    if (mn <= S && mx >= S) {
      long long siz = i;
      for (long long j = l; j <= r && siz; j++) {
        mn = ((siz - 1) * (j + 1 + j + siz - 1)) >> 1ll,
        mx = ((siz - 1) * (r + r - (siz - 1) + 1)) >> 1ll;
        if (mn <= S - j && mx >= S - j) {
          ans[n - j + 1] = 1;
          S -= j;
          --siz;
        }
      }
      return;
    }
  }
}
void Check(long long i, long long v) { assert(!t[i] || t[i] == v); }
signed main() {
  scanf("%lld", &n);
  vec[0].push_back(0);
  bool allone = 1;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", t + i);
    allone &= (t[i] <= 1);
    v[i] = (t[i] == 0) + v[i - 1];
    if (t[i]) {
      while (top && t[vec[stk[top]][0]] < t[i]) --top;
      if (!top || t[vec[stk[top]][0]] < t[i]) stk[++top] = ++cnt;
      vec[stk[top]].push_back(i);
    }
  }
  if (allone) {
    for (long long i = 1; i <= n; i++) putchar('0');
    return 0;
  }
  memset(f, 0x7f7f7f7f, sizeof f);
  f[1][0] = 0;
  for (long long i = 1; i <= cnt; i++) {
    bool same = 1;
    long long p = vec[i].back();
    for (long long j = 0; j < (long long)vec[i].size() - 1; j++) {
      same &= (t[vec[i][j]] == t[vec[i][j + 1]]);
      if (t[p] > t[vec[i][j]]) p = vec[i][j];
    }
    for (long long j = 0; j < 2; j++) {
      long long end = f[j][i - 1];
      if (end > n || (end > vec[i - 1].back() && t[end])) continue;
      long long sum = t[vec[i - 1].back()] - (end != vec[i - 1].back());
      if (same)
        if (i == cnt) {
          long long L = end + 1, R = vec[i][0] - 1;
          long long S = t[vec[i][0]] - 1 - sum;
          if (n - S + 1 >= vec[cnt][0] + 1 && n - S + 1 <= n && !t[n - S + 1]) {
            f[0][cnt] = n - S + 1;
            g[0][cnt] = j;
          } else if (L <= R) {
            std::swap(L, R);
            L = n - L + 1, R = n - R + 1;
            for (long long i = 0; i <= R - L + 1; i++) {
              long long mn = (i * (L + L + i - 1)) >> 1ll,
                        mx = (i * (R + R - i + 1)) >> 1ll;
              if (mn <= S && mx >= S) {
                f[0][cnt] = 0;
                g[0][cnt] = j;
                break;
              }
              long long l = std::max(vec[cnt][0] + 1, n + 1 - S + mn),
                        r = std::min(n, n + 1 - S + mx);
              if (l <= r && v[r] - v[l - 1] > 0) {
                for (long long k = l; k <= r; k++)
                  if (!t[k]) {
                    f[0][cnt] = k;
                    g[0][cnt] = j;
                  }
                break;
              }
            }
          }
        } else {
          long long This = canget(end + 1, vec[i][0] - 1,
                                  t[vec[i][0]] - 1 - sum, vec[i].back() + 1);
          if (This < f[0][i]) {
            f[0][i] = This;
            g[0][i] = j;
          }
        }
      if (!same || vec[i].size() == 1) {
        if (canget(end + 1, vec[i][0] - 1, t[p] - sum - (n - p + 1))) {
          f[1][i] = p;
          g[1][i] = j;
        }
      }
    }
    if (f[0][i] > n && f[1][i] > n && i == cnt) {
      for (long long i = 0; i < vec[cnt].size(); i++)
        vec[cnt - 1].push_back(vec[cnt][i]);
      --cnt;
      i -= 2;
      f[0][cnt] = f[1][cnt] = 0x7f7f7f7f;
    }
  }
  long long p = (f[0][cnt] <= n ? 0 : 1);
  for (long long i = cnt; i; i--) {
    ans[f[p][i]] = 1;
    long long pre = g[p][i];
    long long sum =
        (t[f[p][i]] ? t[f[p][i]] : (t[vec[i].back()] - 1)) -
        ((t[f[pre][i - 1]] || i == 1) ? t[f[pre][i - 1]]
                                      : (t[vec[i - 1].back()] - 1)) -
        (n - f[p][i] + 1);
    if (!f[p][i]) sum += n - f[p][i] + 1;
    get(f[pre][i - 1] + 1, vec[i][0] - 1, sum);
    p = pre;
  }
  for (long long i = 1; i <= n; i++) printf("%d", ans[i]);
  long long sum = 0;
  for (long long i = 1, last = 0; i <= n; i++) {
    if (ans[i]) {
      sum += n - i + 1;
      Check(i, sum);
      for (long long j = last + 1; j < i; j++) Check(j, sum + 1);
      last = i;
    } else if (i == n) {
      for (long long j = last + 1; j < i; j++) Check(j, sum + 1);
    }
  }
}
