#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int n, a[maxn], belong[maxn], bn = 1;
int ans[maxn][maxn];
struct node {
  int l, r;
} block[maxn];
bool cmp(node x, node y) { return (x.r - x.l) > (y.r - y.l); }
int main() {
  int l, r, flag;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], belong[i] = 1;
  belong[0] = 1;
  block[1].l = 0;
  block[1].r = n;
  for (int i = 1; i <= n; i++) {
    sort(block + 1, block + 1 + bn, cmp);
    flag = 0;
    int bto = bn;
    for (int b = 1; b <= bto; b++) {
      l = block[b].l;
      r = block[b].r;
      if (a[i] > bto - b + 1) {
        if (flag == 0)
          while (a[i] > bto - b && l < r) ans[i][l++] = 1, a[i]--;
        else
          while (a[i] > bto - b && l <= r) ans[i][l++] = 1, a[i]--;
        if (--l < r) {
          flag = 1;
          block[++bn].l = block[b].l;
          block[bn].r = l;
          block[b].l = l + 1;
          for (int j = block[bn].l; j <= l; j++) belong[j] = bn;
        }
      } else if (a[i] > 0) {
        ans[i][l] = 1;
        a[i]--;
        if (l < r) {
          flag = 1;
          belong[l] = ++bn;
          block[bn].l = block[bn].r = l;
          block[b].l = l + 1;
        }
      }
    }
  }
  cout << bn << endl;
  for (int j = 0; j <= n; j++) {
    for (int i = 1; i <= n; i++) {
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}
