#include <bits/stdc++.h>
using namespace std;
const int mxn = 1001;
int n;
int a[mxn][mxn];
vector<int> v[mxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0, x; i < n; i++) cin >> x, v[x].push_back(i);
  for (int i = n, j = 0; i; i--)
    for (int k = 0; k < v[i].size(); j++, k++)
      for (int l = 0; l < i; l++) {
        a[(j + l) % (n + 1)][v[i][k]] = 1;
      }
  cout << (n + 1) << '\n';
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < n; j++) cout << a[i][j];
    cout << '\n';
  }
  return 0;
}
