#include <bits/stdc++.h>
using namespace std;
int N;
pair<int, int> A[1005];
int cnt;
char S[1005][1005];
void Read() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i].first);
    A[i].second = i;
  }
  sort(A + 1, A + N + 1);
}
void Solve(int pos) {
  ++cnt;
  for (int p = 1; p <= N; p++) S[cnt][p] = '0';
  S[cnt][A[pos].second] = '1';
  int start = 1;
  if (A[pos - 1].first < pos) start = 2;
  for (int j = start; j - start + 1 <= min(A[pos].first - 1, pos - 1); j++) {
    S[j][A[pos].second] = '1';
  }
  for (int j = 1; j < pos; j++)
    if (A[j].first >= pos) S[cnt][A[j].second] = '1';
}
void PrintSol() {
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; i++) {
    printf("%s\n", S[i] + 1);
  }
}
int main() {
  Read();
  ++cnt;
  for (int i = 1; i <= N; i++) S[1][i] = '0';
  for (int i = 1; i <= N; i++) Solve(i);
  PrintSol();
  return 0;
}
