#include <bits/stdc++.h>
int N;
long long T[200002];
int segL[200002], segR[200002], G;
int f[200002], g[200002], f_from[200002], g_from[200002];
int S_not_given[200002];
long long min_select(long long L1, long long R1, long long L2, long long R2,
                     long long need) {
  L1 = N - L1 + 1;
  L2 = N - L2 + 1;
  R1 = N - R1 + 1;
  R2 = N - R2 + 1;
  std::swap(L1, R1);
  std::swap(L2, R2);
  long long ans = -1000000000;
  for (long long number = 0; number <= R1 - L1 + 1; number++) {
    long long low = need - (long long)(R1 + R1 - number + 1) * number / 2;
    long long upp = need - (long long)(L1 + L1 + number - 1) * number / 2;
    if (std::max(low, L2) <= std::min(upp, R2))
      ans = std::max(ans, std::min(upp, R2));
  }
  return ans < 0 ? -1 : N - ans + 1;
}
int O[200002];
void construct(long long L, long long R, long long need) {
  if (need == 0) return;
  for (long long number = 0; number <= R - L + 1; number++) {
    long long low = ((N - R + 1) + (N - R + 1) + number - 1) * number / 2;
    long long upp = ((N - L + 1) + (N - L + 1) - number + 1) * number / 2;
    if (low <= need && need <= upp) {
      long long lnum = number - 1;
      long long S;
      while ((S = ((N - L + 1) + (N - L + 1) - lnum + 1) * lnum / 2 +
                  ((N - R + 1) + (N - R + 1) + number - lnum - 1) *
                      (number - lnum) / 2) > need)
        lnum--;
      for (int i = L; i <= L + lnum - 1; i++) {
        O[i] = 1;
        need -= N - i + 1;
      }
      for (int i = R - (number - lnum) + 2; i <= R; i++) {
        O[i] = 1;
        need -= N - i + 1;
      }
      O[N - need + 1] = 1;
      return;
    }
  }
}
void get_O_g(int i);
void get_O_f(int i) {
  if (!i) return;
  O[f[i]] = 1;
  if (f_from[i] == 0) {
    construct(f[i - 1] + 1, segL[i] - 1,
              T[segL[i]] - T[segL[i - 1]] - (N - f[i] + 1));
    get_O_f(i - 1);
  } else {
    construct(segR[i - 1] + 1, segL[i] - 1,
              T[segL[i]] - T[segR[i - 1]] - 1 - (N - f[i] + 1));
    get_O_g(i - 1);
  }
}
void get_O_g(int i) {
  if (!i) return;
  O[segR[i]] = 1;
  if (g_from[i] == 0) {
    construct(f[i - 1] + 1, segL[i] - 1,
              T[segR[i]] - T[segL[i - 1]] + 1 - (N - segR[i] + 1));
    get_O_f(i - 1);
  } else {
    construct(segR[i - 1] + 1, segL[i] - 1,
              T[segR[i]] - T[segR[i - 1]] - (N - segR[i] + 1));
    get_O_g(i - 1);
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%lld", T + i);
  for (int i = 1; i <= N; i++)
    S_not_given[i] = S_not_given[i - 1] + (T[i] == 0);
  for (int i = 1; i <= N; i++)
    if (T[i]) {
      if (!G || T[segR[G]] < T[i]) {
        segL[++G] = i;
        segR[G] = i;
      } else
        segR[G] = i;
    }
  if (G == 0) {
    for (int i = 1; i <= N; i++) putchar('0');
    return 0;
  }
  f[0] = -1;
  g[0] = 1;
  segR[0] = 0;
  T[0] = 0;
  for (int i = 1; i <= G - 1; i++) {
    int f_from_f = -1, f_from_g = -1, g_from_f = 0, g_from_g = 0;
    if (T[segL[i]] == T[segR[i]]) {
      if (f[i - 1] != -1)
        f_from_f = min_select(f[i - 1] + 1, segL[i] - 1, segR[i] + 1,
                              segL[i + 1] - 1, T[segL[i]] - T[segL[i - 1]]);
      if (g[i - 1])
        f_from_g = min_select(segR[i - 1] + 1, segL[i] - 1, segR[i] + 1,
                              segL[i + 1] - 1, T[segL[i]] - T[segR[i - 1]] - 1);
    }
    if (segL[i] == segR[i] || T[segL[i]] - T[segR[i]] == 1) {
      if (f[i - 1] != -1)
        g_from_f = min_select(f[i - 1] + 1, segL[i] - 1, segR[i], segR[i],
                              T[segR[i]] - T[segL[i - 1]] + 1) != -1;
      if (g[i - 1])
        g_from_g = min_select(segR[i - 1] + 1, segL[i] - 1, segR[i], segR[i],
                              T[segR[i]] - T[segR[i - 1]]) != -1;
    }
    if (f_from_f == -1 && f_from_g == -1)
      f[i] = -1;
    else if (f_from_g == -1 || f_from_f != -1 && f_from_f <= f_from_g) {
      f[i] = f_from_f;
      f_from[i] = 0;
    } else if (f_from_f == -1) {
      f[i] = f_from_g;
      f_from[i] = 1;
    }
    g[i] = g_from_f | g_from_g;
    g_from[i] = !g_from_f;
  }
  if (f[G - 1] != -1) {
    int L1 = f[G - 1] + 1, R1 = segL[G] - 1;
    if (T[segL[G]] == T[segR[G]]) {
      long long need = T[segL[G]] - T[segL[G - 1]];
      if (need == 0) {
        get_O_f(G - 1);
        for (int i = 1; i <= N; i++) putchar(O[i] + '0');
        puts("");
        return 0;
      }
      for (int number = 0; number <= R1 - L1 + 1; number++) {
        long long low =
            (long long)((N - R1 + 1) + (N - R1 + 1) + number - 1) * number / 2;
        long long upp =
            (long long)((N - L1 + 1) + (N - L1 + 1) - number + 1) * number / 2;
        low = N + 1 - (need - low);
        upp = N + 1 - (need - upp);
        low = std::max(low, (long long)segL[G]);
        upp = std::min(upp, (long long)N);
        if (low <= upp && S_not_given[upp] - S_not_given[low - 1] > 0) {
          int pos = low;
          while (T[pos] != 0) pos++;
          O[pos] = 1;
          construct(L1, R1, need - (N - pos + 1));
          get_O_f(G - 1);
          for (int i = 1; i <= N; i++) putchar(O[i] + '0');
          puts("");
          return 0;
        }
      }
    }
    if (segL[G] == segR[G] || T[segL[G]] - T[segR[G]] == 1) {
      long long need = T[segR[G]] - T[segL[G - 1]] + 1;
      for (int number = 0; number <= R1 - L1 + 1; number++) {
        long long low =
            (long long)((N - R1 + 1) + (N - R1 + 1) + number - 1) * number / 2;
        long long upp =
            (long long)((N - L1 + 1) + (N - L1 + 1) - number + 1) * number / 2;
        low = N + 1 - (need - low);
        upp = N + 1 - (need - upp);
        if (low <= segR[G] && segR[G] <= upp) {
          O[segR[G]] = 1;
          construct(L1, R1, need - (N - segR[G] + 1));
          get_O_f(G - 1);
          for (int i = 1; i <= N; i++) putchar(O[i] + '0');
          puts("");
          return 0;
        }
      }
    }
  }
  if (g[G - 1]) {
    int L1 = segR[G - 1] + 1, R1 = segL[G] - 1;
    if (T[segL[G]] == T[segR[G]]) {
      long long need = T[segL[G]] - T[segR[G - 1]] - 1;
      if (need == 0) {
        get_O_g(G - 1);
        for (int i = 1; i <= N; i++) putchar(O[i] + '0');
        puts("");
        return 0;
      }
      for (int number = 0; number <= R1 - L1 + 1; number++) {
        long long low =
            (long long)((N - R1 + 1) + (N - R1 + 1) + number - 1) * number / 2;
        long long upp =
            (long long)((N - L1 + 1) + (N - L1 + 1) - number + 1) * number / 2;
        low = N + 1 - (need - low);
        upp = N + 1 - (need - upp);
        low = std::max(low, (long long)segL[G]);
        upp = std::min(upp, (long long)N);
        if (low <= upp && S_not_given[upp] - S_not_given[low - 1] > 0) {
          int pos = low;
          while (T[pos] != 0) pos++;
          O[pos] = 1;
          construct(L1, R1, need - (N - pos + 1));
          get_O_g(G - 1);
          for (int i = 1; i <= N; i++) putchar(O[i] + '0');
          puts("");
          return 0;
        }
      }
    }
    if (segL[G] == segR[G] || T[segL[G]] - T[segR[G]] == 1) {
      long long need = T[segR[G]] - T[segR[G - 1]];
      for (int number = 0; number <= R1 - L1 + 1; number++) {
        long long low =
            (long long)((N - R1 + 1) + (N - R1 + 1) + number - 1) * number / 2;
        long long upp =
            (long long)((N - L1 + 1) + (N - L1 + 1) - number + 1) * number / 2;
        low = N + 1 - (need - low);
        upp = N + 1 - (need - upp);
        if (low <= segR[G] && segR[G] <= upp) {
          O[segR[G]] = 1;
          construct(L1, R1, need - (N - segR[G] + 1));
          get_O_g(G - 1);
          for (int i = 1; i <= N; i++) putchar(O[i] + '0');
          puts("");
          return 0;
        }
      }
    }
  }
  return 0;
}
