#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct tree {
  tree* next[2] = {};
};
int a[1100], g[1100][1100];
tree* nodes[1100];
tree root;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (ll i = (0); i < (n + 1); ++i) cin >> a[i], nodes[i] = &root;
  for (ll i = (0); i < (n); ++i)
    for (ll j = (0); j < (a[i]); ++j) g[i][j] = 1;
  for (ll i = (0); i < (n); ++i) {
    int corner = i + 1;
    for (ll j = (0); j < (corner); ++j) {
      if (nodes[j] == nodes[corner]) {
        if (g[i][j] == g[i][corner]) {
          if (g[i][j] == 0) {
            g[i][0] = 0;
            g[i][corner] = 1;
          } else {
            g[i][n] = 1;
            g[i][corner] = 0;
          }
        }
        break;
      }
    }
    for (ll j = (0); j < (n + 1); ++j) {
      for (ll k = (0); k < (2); ++k)
        if (!nodes[j]->next[k]) nodes[j]->next[k] = new tree;
      nodes[j] = nodes[j]->next[g[i][j]];
    }
  }
  ll rows = 0;
  string res;
  for (ll j = (0); j < ((n) + 1); ++j) {
    string row;
    for (ll i = (0); i < (n); ++i) row += g[i][j] ? '1' : '0';
    row += '\n';
    if (row.find('1') != string::npos) {
      res += row;
      ++rows;
    }
  }
  cout << rows << endl << res;
  return 0;
}
