#include <bits/stdc++.h>
using namespace std;
const int N = 1002;
void solve(vector<int> &a, int p, vector<bitset<N>> &ops) {
  int n = a.size();
  if (p == n) return;
  int cp = ops.size();
  bitset<N> ini;
  bool found = false;
  for (int k = p + 1; k < n; ++k) {
    if (a[k] > 1) {
      found = true;
      ini[k] = 1;
      --a[k];
    }
  }
  if (found) {
    --a[p];
    ops.push_back(ini);
  }
  solve(a, p + 1, ops);
  if (ops.size() - cp == n - p + 1) {
    int k = 0;
    while (a[p] > 0) {
      if (found and ops[cp + k] == ops[cp]) {
        ++k;
        continue;
      }
      ops[cp + k][p] = 1;
      --a[p];
      ++k;
    }
  } else {
    int k = 0;
    while (a[p] > 1) {
      if (found and ops[cp + k] == ops[cp]) {
        ++k;
        continue;
      }
      ops[cp + k][p] = 1;
      --a[p];
      ++k;
    }
    if (a[p] > 0) {
      bitset<N> add;
      add[p] = 1;
      --a[p];
      ops.push_back(add);
    }
  }
  if (found) ops[cp][p] = 1;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<bitset<N>> ops;
  solve(a, 0, ops);
  cout << ops.size() << endl;
  for (bitset<N> b : ops) {
    for (int i = 0; i < n; ++i) cout << b[i];
    cout << endl;
  }
  for (int x : a) cerr << x << " ";
  cerr << endl;
}
