#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
long long fac[1] = {1}, inv[1] = {1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long mp(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return ret;
}
long long cmb(long long r, long long c) {
  return fac[r] * inv[c] % MOD * inv[r - c] % MOD;
}
priority_queue<int, vector<int>, greater<int>> pq;
vector<int> v;
char mat[1001][1001];
int vec[1001];
int main() {
  int n;
  scanf("%d", &n);
  int aa = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &vec[i]);
    aa = max(aa, vec[i] + 1);
  }
  for (int i = 0; i < n; i++) {
    pair<int, int> mavi = {0, 0};
    for (int j = 0; j < n; j++) mavi = max(mavi, {vec[j], j});
    vec[mavi.second] = 0;
    for (int j = 0; j < mavi.first; j++) mat[(i + j) % aa][mavi.second] = 1;
  }
  printf("%d\n", aa);
  for (int i = 0; i < aa; i++) {
    for (int j = 0; j < n; j++) printf("%d", mat[i][j]);
    printf("\n");
  }
}
