#include <bits/stdc++.h>
using namespace std;
int n;
int p[1005][1005];
int a[1005], id[1005];
int cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  scanf("%d", &n);
  for (int(i) = (1); (i) <= (n); (i)++) scanf("%d", &a[i]), id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  for (int(i) = (n); (i) >= (1); (i)--)
    for (int j = n - i, k = 1; k <= min(a[id[i]], n - 1); k++, j--) {
      if (!j) j = n;
      p[j][id[i]] = 1;
    }
  for (int(i) = (1); (i) <= (n); (i)++)
    if (a[i] == n) p[n + 1][i] = 1;
  bool tmp = 1;
  for (int(i) = (1); (i) <= (n); (i)++)
    if (p[n][i] != p[n + 1][i]) {
      tmp = 0;
      break;
    }
  if (tmp) {
    for (int(i) = (n); (i) >= (1); (i)--)
      if (a[id[i]] == n && a[id[i - 1]] != n) {
        p[n + 1][id[i]] = 0;
        p[n - i + 1][id[i]] = 1;
        break;
      }
  }
  printf("%d\n", n + 1);
  for (int(i) = (1); (i) <= (n + 1); (i)++) {
    for (int(j) = (1); (j) <= (n); (j)++) printf("%d", p[i][j]);
    puts("");
  }
  return 0;
}
