#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n, a[N], p[N], q[N], pos[N], maxn, ans[N][N];
int pre(int x) {
  if (x > 1) return x - 1;
  return n;
}
bool cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = gi(), p[i] = i;
  sort(p + 1, p + n + 1, cmp);
  for (int i = 1; i <= n; i++) q[p[i]] = i;
  for (int i = 1; i <= n; i++) pos[i] = n - q[i] + 1;
  for (int i = 1; i <= n; i++)
    for (int j = pre(pos[i]), k = 1; k <= min(a[i], n - 1); j = pre(j), ++k)
      ans[j][i] = 1;
  for (int i = 1; i <= n; i++)
    if (a[i] == n) ans[n + 1][i] = 1;
  bool fl = 1;
  for (int i = 1; i <= n; i++)
    if (ans[n][i] != ans[n + 1][i]) {
      fl = 0;
      break;
    }
  if (fl) {
    for (int i = 1; i <= n; i++)
      if (a[i] == n && !ans[n + 1][i - 1]) {
        swap(ans[n + 1][i], ans[pos[i]][i]);
        break;
      }
  }
  cout << n + 1 << '\n';
  for (int i = 1; i <= n + 1; i++, cout << '\n')
    for (int j = 1; j <= n; j++) cout << char(ans[i][j] + '0');
  return 0;
}
