#include <bits/stdc++.h>
using namespace std;
struct __timestamper {};
vector<string> solve(vector<int> a) {
  int n = a.size();
  for (int i = 0; i < n - 1; i++) assert(a[i] >= a[i + 1]);
  if (n == 0) return vector<string>();
  if (a[0] == 1) {
    for (int x : a) assert(x == 1);
    vector<string> res;
    res.push_back(string(n, '1'));
    return res;
  }
  if (a.back() == n) {
    vector<string> res(n + 1);
    for (int i = 0; i <= n; i++) {
      res[i] = string(n, '1');
      if (i > 0) res[i][i - 1] = '0';
    }
    return res;
  }
  int x = a.back();
  assert(x < n);
  a.pop_back();
  string cur(n - 1, '0');
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == n) {
      a[i]--;
      cur[i] = '1';
    }
  }
  auto res = solve(a);
  int left = x - 1;
  for (int i = 0; i < (int)res.size(); i++) {
    char c = '0';
    if (left > 0 && res[i] != cur) {
      left--;
      c = '1';
    }
    res[i] += c;
  }
  cur += '1';
  res.push_back(cur);
  return res;
}
vector<string> fast(vector<int> a) {
  int n = a.size();
  vector<pair<int, int>> b(n);
  for (int i = 0; i < n; i++) b[i] = {a[i], i};
  sort(b.rbegin(), b.rend());
  vector<int> c(n);
  for (int i = 0; i < n; i++) c[i] = b[i].first;
  auto s = solve(c);
  vector<string> res;
  for (auto o : s) {
    string t(n, '.');
    for (int j = 0; j < n; j++) {
      t[b[j].second] = o[j];
    }
    res.push_back(t);
  }
  sort(res.begin(), res.end());
  for (int i = 0; i < (int)res.size() - 1; i++) assert(res[i] != res[i + 1]);
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    for (int j = 0; j < (int)res.size(); j++) {
      cnt += res[j][i] == '1';
    }
    assert(cnt == a[i]);
  }
  return res;
}
void stress() {
  for (int it = 59;; it++) {
    mt19937 rnd(it);
    cerr << "it"
         << " = " << it << endl;
    int n = 1e3;
    vector<int> a(n);
    for (int i = 0; i < n; i++) a[i] = rnd() % n + 1;
    cerr << "a"
         << " = ";
    for (auto xxxx : a) cerr << xxxx << " ";
    cerr << endl;
    fast(a);
  }
}
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    vector<int> a(n);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    auto res = fast(a);
    printf("%d\n", (int)res.size());
    for (auto s : res) printf("%s\n", s.c_str());
  }
  return 0;
}
