#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
int readint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, cnt;
int ans[1005][1005], tmp[1005];
pair<int, int> a[1005];
int main() {
  n = readint();
  for (int i = 1; i <= n; i++) a[i].first = readint(), a[i].second = i;
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= i + a[i].first; j++) ans[j][i] = 1;
    for (int j = i + 1; j <= n; j++)
      if (a[j].first == n - i + 1) a[j].first--, ans[i][j] = 1;
  }
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 1; j <= n; j++) tmp[a[j].second] = ans[i][j];
    for (int j = 1; j <= n; j++) ans[i][j] = tmp[j];
    bool fl = 0;
    for (int j = 1; j <= n; j++)
      if (ans[i][j]) fl = 1;
    cnt += fl;
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= n + 1; i++) {
    bool fl = 0;
    for (int j = 1; j <= n; j++)
      if (ans[i][j]) fl = 1;
    if (fl) {
      for (int j = 1; j <= n; j++) printf("%d", ans[i][j]);
      printf("\n");
    }
  }
  return 0;
}
