#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 1066;
int n, a[N], id[N];
bitset<N> ans[N];
int sz;
bool cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  read(n);
  for (register int i = (1); i <= (n); i++) read(a[i]), id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  for (register int i = (n); i >= (1); i--) {
    int need = min(a[id[i]], n - i + 1) - 1;
    ++sz;
    ans[sz][id[i]] = 1;
    for (register int j = (i + 1); j <= (n); j++)
      if (a[id[j]] >= n - i + 1) ans[sz][id[j]] = 1;
    for (register int j = (1); j <= (sz - 1); j++)
      if (need) {
        ans[j][id[i]] = 1;
        need--;
        if (ans[j] == ans[sz]) {
          need++;
          ans[j][id[i]] = 0;
        }
      }
    if (need) {
      assert(min(a[id[i]], n - i + 1) == n - i + 1 && need == 1);
      ans[++sz][id[i]] = 1;
    }
  }
  printf("%d\n", sz);
  for (register int i = (1); i <= (sz); i++) {
    for (register int j = (1); j <= (n); j++) printf("%d", (int)ans[i][j]);
    puts("");
  }
  return 0;
}
