#include <bits/stdc++.h>
using namespace std;
namespace fastIO {
bool IOerror = 0;
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline long long read() {
  bool sign = 0;
  char ch = getchar();
  long long x = 0;
  for (; blank(ch); ch = getchar())
    ;
  if (IOerror) return 0;
  if (ch == '-') sign = 1, ch = getchar();
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  if (sign) x = -x;
  return x;
}
};  // namespace fastIO
using namespace fastIO;
struct node {
  long long l, r, len;
  node(long long x, long long y) { l = x, r = y, len = y - x + 1; }
  bool operator<(const node& bb) const {
    return len != bb.len ? len > bb.len : l < bb.l;
  }
};
set<node> s;
long long now = 0;
long long l[1000010], r[1000010], len[1000010], num[1000010], ans[2010][2010];
signed main() {
  long long n = read(), maxx = 0;
  s.insert(node(1, n + 1));
  for (long long i = 1; i <= n; i++) {
    long long x = read();
    now = 0;
    for (auto i : s) {
      l[++now] = i.l, r[now] = i.r, len[now] = i.len;
      num[now] = 0;
    }
    for (long long j = 1; j <= now; j++) {
      num[j] = 1;
      ans[l[j]][i] = 1;
      maxx = max(maxx, l[j]);
      x--;
      if (!x) break;
    }
    if (x) {
      for (long long j = 1; j <= now; j++) {
        while (num[j] < len[j] - 1 && x) {
          ans[l[j] + num[j]][i] = 1;
          maxx = max(maxx, l[j] + num[j]);
          num[j]++;
          x--;
        }
      }
    }
    if (x) {
      for (long long j = 1; j <= now; j++) {
        if (x && num[j] != len[j])
          ans[r[j]][i] = 1, x--, num[j]++, maxx = max(maxx, r[j]);
      }
    }
    s.clear();
    for (long long j = 1; j <= now; j++) {
      if (num[j]) s.insert(node(l[j], l[j] + num[j] - 1));
      if (num[j] != len[j]) s.insert(node(l[j] + num[j], r[j]));
      if (len[j] == 1) s.insert(node(l[j], r[j]));
    }
  }
  cout << maxx << "\n";
  for (long long i = 1; i <= maxx; i++) {
    for (long long j = 1; j <= n; j++) cout << ans[i][j];
    cout << "\n";
  }
  return 0;
}
