#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 9;
int n, a[N], ans[N][N], m[N][2], g[N], e;
vector<pair<int, int> > p;
pair<int, int> k;
int solve(int x, int y) { return min(x - 1, y); }
int main() {
  cin >> n;
  for (int i = 1; i < n + 1; i++) cin >> a[i];
  p.push_back(make_pair(1, n + 2));
  for (int i = 1; i < n + 1; i++) {
    while (p[p.size() - 1].second - p[p.size() - 1].first == 1) p.pop_back();
    m[i][0] = p[p.size() - 1].first;
    m[i][1] = p[p.size() - 1].second;
    e = solve(m[i][1] - m[i][0], a[i]);
    a[i] -= e;
    for (int j = m[i][0]; j < m[i][0] + e; j++) ans[i][j] = 1;
    k = p[p.size() - 1];
    p.pop_back();
    p.push_back(make_pair(m[i][0], m[i][0] + e));
    p.push_back(make_pair(m[i][0] + e, m[i][1]));
  }
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < n + 2; j++) {
      if (a[i] && (j < m[i][0] || j >= m[i][1])) ans[i][j] = 1, a[i]--;
    }
  }
  cout << n + 1 << endl;
  for (int i = 1; i < n + 2; i++) {
    for (int j = 1; j < n + 1; j++) cout << ans[j][i];
    cout << endl;
  }
}
