#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e3 + 1;
long long a[MAXN];
long long cl[MAXN];
long long g[MAXN][MAXN];
vector<long long> ps[MAXN];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    for (long long j = 0; j < n + 1; ++j) ps[j].clear();
    for (long long j = 0; j < n + 1; ++j) ps[cl[j]].push_back(j);
    long long bad = -1;
    for (long long j = 0; j < n + 1; ++j)
      if (ps[j].size() >= 2) bad = j;
    vector<long long> c(n + 1);
    for (long long j = 0; j < n + 1; ++j) c[j] = (j < a[i]);
    if (bad != -1) {
      long long ps1 = ps[bad][0];
      long long ps2 = ps[bad][1];
      if (c[ps1] == c[ps2]) {
        if (c[ps1] == 0)
          swap(c[ps1], c[0]);
        else
          swap(c.back(), c[ps2]);
      }
    }
    map<pair<long long, long long>, long long> id;
    long long ptr = 0;
    for (long long j = 0; j < n + 1; ++j) {
      pair<long long, long long> curr = {cl[j], c[j]};
      if (id.find(curr) == id.end()) id[curr] = ptr++;
      cl[j] = id[curr];
    }
    for (long long j = 0; j < n + 1; ++j) g[i][j] = c[j];
  }
  long long bad = -1;
  for (long long i = 0; i < n + 1; ++i) {
    bool ok = 1;
    for (long long j = 0; j < n; ++j)
      if (g[j][i]) ok = 0;
    if (ok) bad = i;
  }
  cout << n + 1 - (bad != -1) << endl;
  for (long long i = 0; i < n + 1; ++i) {
    if (i == bad) continue;
    for (long long j = 0; j < n; ++j) cout << g[j][i] << "";
    cout << endl;
  }
  return;
}
signed main() {
  ios::sync_with_stdio(false);
  long long t = 1;
  for (long long i = 0; i < t; ++i) solve();
  return 0;
}
