#include <bits/stdc++.h>
inline int read() {
  int num = 0, f = 1;
  char c = getchar();
  while (c < 48 || c > 57) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c > 47 && c < 58) num = num * 10 + (c ^ 48), c = getchar();
  return num * f;
}
inline int re1d() {
  char c = getchar();
  while (c < 48 || c > 49) c = getchar();
  return c & 1;
}
inline int min(int a, int b) { return a > b ? b : a; }
inline int max(int a, int b) { return a < b ? b : a; }
int a[4005], dp[4005][4005], p[4005], q[4005];
signed main() {
  int n = read();
  printf("%d\n", n + 1);
  for (int i = 1; i <= (n); i++) {
    a[i] = read();
    p[i] = i;
  }
  std::sort(p + 1, p + 1 + n, [&](int x, int y) { return x[a] > y[a]; });
  for (int i = 1; i <= (n); i++) {
    for (int j = 1; j <= (a[p[i]]); j++) {
      dp[(j + i) % (n + 1)][p[i]] = 1;
    }
  }
  for (int i = 0; i < (n + 1); i++) {
    for (int j = 1; j <= (n); j++) {
      printf("%d", dp[i][j]);
    }
    puts("");
  }
  return 0;
}
