#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0;
  char ch = getchar();
  bool positive = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') positive = 0;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return positive ? x : -x;
}
inline void write(long long a) {
  if (a < 0) {
    a = -a;
    putchar('-');
  }
  if (a >= 10) write(a / 10);
  putchar('0' + a % 10);
}
inline void writeln(long long a) {
  write(a);
  puts("");
}
inline void wri(long long a) {
  write(a);
  putchar(' ');
}
inline unsigned long long rnd() {
  return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;
}
const int N = 1005;
int a[N];
vector<int> v[N];
bool ans[N][N];
int main() {
  int n = read();
  for (int i = (int)(1); i <= (int)(n); i++) a[i] = read();
  for (int i = (int)(0); i <= (int)(a[1] - 1); i++) {
    ans[i][1] = 1;
    v[0].push_back(i);
  }
  for (int i = (int)(a[1]); i <= (int)(n); i++) v[1].push_back(i);
  for (int i = (int)(2); i <= (int)(n); i++) {
    int bj = 0;
    for (int j = (int)(0); j <= (int)(i - 1); j++)
      if (v[j].size() >= 2) {
        int t = min(a[i], (int)v[j].size() - 1);
        for (int k = (int)(1); k <= (int)(t); k++) {
          int zs = v[j].back();
          v[i].push_back(zs);
          ans[zs][i] = 1;
          v[j].pop_back();
        }
        bj = j;
        a[i] -= t;
        break;
      }
    for (int j = (int)(0); j <= (int)(i - 1); j++)
      if (j != bj) {
        int t = min(a[i], (int)v[j].size());
        for (int k = (int)(0); k <= (int)(t - 1); k++) ans[v[j][k]][i] = 1;
        a[i] -= t;
      }
  }
  cout << n + 1 << endl;
  for (int i = (int)(0); i <= (int)(n); i++) {
    for (int j = (int)(1); j <= (int)(n); j++) write(ans[i][j]);
    puts("");
  }
}
