#include <bits/stdc++.h>
using namespace std;
int n, a[1005];
bool g[1005][1005];
vector<pair<int, int> > va, vb;
vector<int> dones;
int nothing = -1;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  va.push_back({0, n});
  for (int i = 0; i < n; i++) {
    vb.clear();
    int c0 = n + 1 - a[i], c1 = a[i];
    for (auto &p : va) {
      if (p.first == p.second) {
        dones.push_back(p.first);
        continue;
      }
      if (c0 && c1) {
        int cutoff = min(p.second - 1, p.first + c1 - 1);
        c1 -= cutoff - p.first + 1;
        c0 -= p.second - cutoff;
        for (int j = p.first; j <= cutoff; j++) g[j][i] = 1;
        vb.push_back({p.first, cutoff});
        vb.push_back({cutoff + 1, p.second});
      } else {
        vb.push_back(p);
        for (int j = p.first; j <= p.second; j++) {
          if (c1) {
            g[j][i] = 1;
            c1--;
          } else
            c0--;
        }
      }
    }
    for (int j : dones) {
      if (!c1) break;
      c1--;
      g[j][i] = 1;
    }
    va = vb;
  }
  for (int i = 0; i <= n; i++) {
    bool no = 1;
    for (int j = 0; j < n; j++) {
      if (g[i][j]) no = 0;
    }
    if (no) nothing = i;
  }
  printf("%d\n", n + (nothing == -1));
  for (int i = 0; i <= n; i++) {
    if (i == nothing) continue;
    for (int j = 0; j < n; j++) {
      printf(g[i][j] ? "1" : "0");
    }
    printf("\n");
  }
}
