#include <bits/stdc++.h>
using namespace std;
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
const int N = 1005;
int n, a[N][N], cnt = 0, now = -1, p[N], c[N];
void print() {
  printf("%d\n", cnt);
  for (int i = (0); i < (cnt); i++) {
    for (int j = (1); j < (n + 1); j++) printf("%d", a[i][j]);
    printf("\n");
  }
}
bool cmp(int x, int y) { return p[x] > p[y]; }
int main() {
  scanf("%d", &n);
  for (int i = (1); i < (n + 1); i++) scanf("%d", &p[i]), c[i] = i;
  sort(c + 1, c + n + 1, cmp);
  for (int j = (1); j < (n + 1); j++) {
    ++now;
    for (int i = now, k = 1; k <= p[c[j]];
         k++, ++i, i = i % (n + 1), cnt = max(cnt, i + 1))
      a[i][c[j]] = 1;
  }
  print();
  return 0;
}
