#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int neg = 1, num = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') neg = -1;
  for (; isdigit(c); c = getchar()) num = (num << 1) + (num << 3) + c - '0';
  return neg * num;
}
struct node {
  int w, id;
} a[1010];
int n, b[1010][1010], c[1010];
bool cmp(node x, node y) { return x.w > y.w; }
inline bool work(int x) {
  for (int i = 1; i <= n; i++)
    for (int j = 1, pos = i - 1; j <= a[i].w; j++) {
      pos = pos % x + 1;
      b[pos][i] = 1;
    }
  bool f = 0;
  for (int i = 1; i <= x; i++) {
    bool flag = 1;
    for (int j = 1; j <= n; j++) flag &= (b[i][j] == b[i % x + 1][j]);
    f |= flag;
  }
  return f;
}
inline void print(int x) {
  cout << x << endl;
  for (int i = 1; i <= x; i++, putchar('\n'))
    for (int j = 1; j <= n; j++) cout << b[i][c[j]];
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i].w = read(), a[i].id = i;
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) c[a[i].id] = i;
  for (int i = n + 1; i >= 1; i--) {
    if (!work(i)) print(i), exit(0);
    memset(b, 0, sizeof(b));
  }
  return 0;
}
