#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T& x) {
  static char c;
  static int f;
  for (c = getchar(), f = 1; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -f;
  for (x = 0; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + (c & 15);
  x *= f;
}
template <typename T>
void write(T x) {
  static char q[65];
  int cnt = 0;
  if (x < 0) putchar('-'), x = -x;
  q[++cnt] = x % 10, x /= 10;
  while (x) q[++cnt] = x % 10, x /= 10;
  while (cnt) putchar(q[cnt--] + '0');
}
const int maxn = 1005;
int nt[maxn];
int vis[maxn][maxn];
int main() {
  int n;
  read(n);
  for (int i = 1; i <= n; ++i) nt[i] = true;
  for (int i = 1; i <= n; ++i) {
    int v;
    read(v);
    for (int j = 1; j <= v; ++j) vis[j][i] = true;
    if (nt[v])
      nt[v] = false;
    else {
      int ok = false;
      for (int j = 1; j <= v && !ok; ++j) {
        if (!nt[j]) continue;
        nt[j] = false;
        vis[j][i] = false;
        vis[v + 1][i] = true;
        nt[v + 1] = false;
        ok = true;
      }
      for (int j = v + 1; j <= n && !ok; ++j) {
        if (!nt[j]) continue;
        nt[j] = false;
        vis[j][i] = true;
        vis[v][i] = false;
        ok = true;
      }
    }
  }
  write(n + 1), putchar('\n');
  for (int i = 1; i <= n + 1; ++i, putchar('\n'))
    for (int j = 1; j <= n; ++j) write(vis[i][j]);
  return 0;
}
