#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
vector<string> res;
set<int> node[N * N];
int ptr[N * N][2];
int ans[N][N];
int a[N];
int n, sz;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n + 1; i++) node[0].insert(i);
  vector<int> cur({0});
  for (int i = 1; i <= n; i++) {
    vector<int> nxt;
    vector<int> cnt(2);
    cnt[0] = (n + 1) - a[i];
    cnt[1] = a[i];
    for (int u : cur)
      if (node[u].size() > 1) {
        ptr[u][0] = ++sz;
        nxt.push_back(sz);
        ptr[u][1] = ++sz;
        nxt.push_back(sz);
        cnt[0]--;
        cnt[1]--;
        ans[*node[u].begin()][i] = 1;
        ans[*node[u].rbegin()][i] = 0;
        node[ptr[u][1]].insert(*node[u].begin());
        node[ptr[u][0]].insert(*node[u].rbegin());
        node[u].erase(node[u].begin());
        node[u].erase(*node[u].rbegin());
        break;
      }
    for (int u : cur)
      for (int v : node[u]) {
        for (int val = 0; val < 2; val++)
          if (cnt[val]) {
            if (!ptr[u][val]) {
              ptr[u][val] = ++sz;
              nxt.push_back(sz);
            }
            ans[v][i] = val;
            cnt[val]--;
            node[ptr[u][val]].insert(v);
            break;
          }
      }
    cur = nxt;
  }
  for (int i = 1; i <= n + 1; i++) {
    string s;
    bool ok = false;
    for (int j = 1; j <= n; j++) {
      s += ans[i][j] + '0';
      ok |= ans[i][j];
    }
    if (ok) res.push_back(s);
  }
  cout << res.size() << "\n";
  for (string s : res) cout << s << "\n";
  return 0;
}
