#include <bits/stdc++.h>
using namespace std;
int n, a[1005], ans[1005][1005];
int bl[1005], br[1005], tp;
int sg[1005];
void print() {
  for (int i = 1; i <= (n + 1); ++i) {
    int ok = 0;
    for (int j = 1; j <= (n); ++j)
      if (ans[i][j]) ok = 1;
    if (!ok) continue;
    for (int j = 1; j <= (n); ++j) printf("%d", ans[i][j]);
    puts("");
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n); ++i) scanf("%d", a + i);
  tp = 1, bl[1] = 1, br[1] = n + 1;
  for (int i = 1; i <= (n); ++i) {
    int p = 0, s = 0;
    for (int j = 1; j <= (tp); ++j)
      if (j == tp || s + br[j] - bl[j] + 1 >= a[i]) {
        p = j;
        break;
      } else
        s += br[j] - bl[j] + 1;
    int z = (s + br[p] - bl[p] + 1 > a[i]) ? a[i] - s : br[p] - bl[p];
    for (int j = 1; j <= (p - 1); ++j)
      for (int k = bl[j]; k <= (br[j]); ++k) ans[k][i] = 1;
    int l = bl[p], r = br[p];
    for (int j = p + 1; j <= (tp); ++j) bl[j - 1] = bl[j], br[j - 1] = br[j];
    --tp;
    for (int k = l; k <= (l + z - 1); ++k) ans[k][i] = 1;
    int lf = a[i] - s - z;
    for (int k = 1; k <= (n + 1); ++k)
      if (lf && sg[k]) ans[k][i] = 1, --lf;
    if (lf)
      for (int k = 1; k <= (n); ++k)
        if ((k < l || k > r) && !ans[k][i]) {
          ans[k][i] = 1;
          break;
        }
    if (z > 1) {
      bl[++tp] = l;
      br[tp] = l + z - 1;
    } else
      sg[l] = 1;
    if (r - l + 1 - z > 1) {
      bl[++tp] = l + z;
      br[tp] = r;
    } else
      sg[r] = 1;
  }
  int cc = 0;
  for (int i = 1; i <= (n + 1); ++i) {
    int ok = 0;
    for (int j = 1; j <= (n); ++j)
      if (ans[i][j]) ok = 1;
    cc += ok;
  }
  printf("%d\n", cc);
  print();
  return 0;
}
