#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int n, a[1005];
int grp[1005];
int ans[1005][1005];
int sz[1005], hvd[2005];
bool del[1005];
int maxa;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) scanf("%d", &a[i]);
  for (int i = 0; i < (int)(n); i++) maxa = max(maxa, a[i]);
  maxa++;
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(maxa); j++) sz[j] = 0;
    for (int j = 0; j < (int)(maxa); j++) sz[grp[j]]++;
    int cur = -1;
    for (int j = 0; j < (int)(maxa); j++)
      if (sz[j] > 1) cur = j;
    if (cur == -1) {
      for (int j = 0; j < (int)(maxa); j++) ans[j][i] = j < a[i];
      continue;
    }
    for (int j = 0; j < (int)(maxa); j++) ans[j][i] = -1;
    for (int j = 0; j < (int)(maxa); j++)
      if (grp[j] == cur) {
        ans[j][i] = 0;
        break;
      }
    for (int j = maxa - 1; j >= 0; j--)
      if (grp[j] == cur) {
        ans[j][i] = 1;
        break;
      }
    int hv = a[i] - 1;
    for (int j = 0; j < (int)(maxa); j++) {
      if (ans[j][i] != -1) continue;
      ans[j][i] = hv > 0;
      hv--;
    }
    for (int j = 0; j < (int)(maxa); j++) grp[j] = grp[j] * 2 + ans[j][i];
    for (int j = 0; j < (int)(2 * maxa); j++) hvd[j] = -1;
    for (int j = 0; j < (int)(maxa); j++) hvd[grp[j]] = 0;
    int hs = 0;
    for (int j = 0; j < (int)(2 * maxa); j++)
      if (hvd[j] == 0) hvd[j] = hs++;
    for (int j = 0; j < (int)(maxa); j++) grp[j] = hvd[grp[j]];
  }
  int cnt = 0;
  for (int i = 0; i < (int)(maxa); i++) {
    bool ok = false;
    for (int j = 0; j < (int)(n); j++)
      if (ans[i][j]) ok = true;
    del[i] = !ok;
    cnt += del[i];
  }
  printf("%d\n", maxa - cnt);
  for (int i = 0; i < (int)(maxa); i++) {
    if (del[i]) continue;
    for (int j = 0; j < (int)(n); j++) printf("%d", ans[i][j]);
    printf("\n");
  }
  return 0;
}
