#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 5;
int a[maxn], b[maxn], n;
int d[maxn][maxn];
bool cmp(const int x, const int y) { return a[x] > a[y]; }
int main() {
  int n, m = 0, ans;
  scanf("%d", &n);
  ans = n;
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) b[i] = i;
  sort(b, b + n, cmp);
  for (int i = 0; i < n; ++i) m += (a[i] == n);
  if (m > 0) {
    int fg = 0;
    for (int i = m; i < n; ++i) {
      if (a[b[i]] + i > n) fg = 1;
    }
    if (fg || m > 1) {
      for (int i = 1; i < m; ++i) {
        d[n][b[i]] = 1;
        a[b[i]]--;
      }
      ans = n + 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < a[b[i]]; ++j) d[(i + j + 1) % n][b[i]] = 1;
  }
  printf("%d\n", ans);
  for (int i = 0; i < ans; ++i) {
    for (int j = 0; j < n; ++j) printf("%d", d[i][j]);
    puts("");
  };
  return 0;
}
