#include <bits/stdc++.h>
using namespace std;
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << '=' << h << '\n';
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
const int N = 1e3 + 7;
int n;
pair<int, int> a[N];
int ans[N][N];
bool comp(const vector<int> &v1, vector<int> &v2) {
  return v1.size() > v2.size();
}
void fil(int i, int j, int k) {
  (i, j, k);
  ans[i][j] = k;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].first, a[i].second = i;
  sort(a + 1, a + n + 1, greater<pair<int, int>>());
  if (n == 1) {
    cout << 1 << '\n' << 1 << '\n';
    return 0;
  }
  vector<vector<int>> v(1);
  int mxn;
  if (a[1].first == a[2].first)
    mxn = a[1].first + 1;
  else
    mxn = a[1].first;
  for (int i = 1; i <= mxn; i++) v[0].push_back(i);
  (v);
  for (int i = 1; i <= n; i++) {
    (i);
    int c1 = a[i].first, c0 = mxn - a[i].first, pos = a[i].second;
    vector<vector<int>> tv;
    for (auto vv : v) {
      int sz = vv.size();
      vector<int> tmp1;
      vector<int> tmp0;
      assert(c1 + c0 >= sz);
      if (c1 == 0) {
        for (int k = 0; k < sz; k++) fil(vv[k], pos, 0), tmp0.push_back(vv[k]);
        c0 -= sz;
      } else if (c0 == 0) {
        for (int k = 0; k < sz; k++) fil(vv[k], pos, 1), tmp1.push_back(vv[k]);
        c1 -= sz;
      } else {
        int tf1 = min(c1, sz - 1);
        int tf0 = sz - tf1;
        for (int k = 0; k < tf1; k++) fil(vv[k], pos, 1), tmp1.push_back(vv[k]);
        for (int k = tf1; k <= sz - 1; k++)
          fil(vv[k], pos, 0), tmp0.push_back(vv[k]);
        c1 -= tf1;
        c0 -= tf0;
      }
      if (tmp1.size()) tv.push_back(tmp1);
      if (tmp0.size()) tv.push_back(tmp0);
    }
    sort((tv).begin(), (tv).end(), comp);
    (v, tv);
    v = tv;
  }
  cout << mxn << '\n';
  for (int i = 1; i <= mxn; i++) {
    for (int j = 1; j <= n; j++) cout << ans[i][j];
    cout << '\n';
  }
  return 0;
}
