#include <bits/stdc++.h>
using namespace std;
const long long mxpp = 62;
const long long mxsc = 32;
vector<vector<long long> > nu(vector<vector<long long> > isp, long long a,
                              vector<vector<long long> >& prv) {
  vector<vector<long long> > res(mxpp, vector<long long>(mxpp * mxsc));
  prv.resize(mxpp, vector<long long>(mxpp * mxsc, -1));
  for (long long op = 0; op < (mxpp - 1); ++op) {
    for (long long osc = 0; osc < (mxpp * mxsc); ++osc) {
      if (!isp[op][osc]) continue;
      for (long long nup = 1; nup + op < mxpp; ++nup) {
        if (nup * a + osc >= mxpp * mxsc) break;
        if (nup * a + osc < (op + nup) * (op + nup - 1) / 2) break;
        res[nup + op][nup * a + osc] = 1;
        prv[nup + op][nup * a + osc] = nup;
      }
    }
  }
  return res;
}
vector<vector<vector<long long> > > prv;
vector<vector<vector<long long> > > oisp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long m;
  cin >> m;
  vector<long long> a(m);
  for (long long i = 0; i < (m); ++i) cin >> a[i];
  sort((a).begin(), (a).end());
  prv.resize(m);
  vector<vector<long long> > isp(mxpp, vector<long long>(mxpp * mxsc));
  isp[0][0] = 1;
  for (long long i = 0; i < (m); ++i) {
    isp = nu(isp, a[i], prv[i]);
    oisp.push_back(isp);
  }
  long long n = m;
  while (n < mxpp && !isp[n][n * (n - 1) / 2]) ++n;
  if (n == mxpp) {
    cout << "=(" << endl;
    return 0;
  }
  cout << n << endl;
  vector<long long> prc;
  long long curp = n;
  long long curs = n * (n - 1) / 2;
  long long tk;
  long long cnu = m - 1;
  while (cnu >= 0) {
    assert(oisp[cnu][curp][curs]);
    tk = prv[cnu][curp][curs];
    assert(tk != -1);
    for (long long z = 0; z < (tk); ++z) prc.push_back(a[cnu]);
    curs -= a[cnu] * tk;
    curp -= tk;
    --cnu;
  }
  sort((prc).begin(), (prc).end());
  vector<vector<long long> > rs(n, vector<long long>(n));
  vector<long long> lft(n);
  for (long long i = 0; i < (n); ++i) lft[i] = n - 1 - prc[i];
  vector<long long> done(n);
  for (long long z = 0; z < (n); ++z) {
    long long mxd = -1;
    for (long long i = 0; i < (n); ++i) {
      if (!done[i]) mxd = max(mxd, prc[i]);
    }
    for (long long i = 0; i < (n); ++i) {
      if (!done[i] && prc[i] == mxd) {
        done[i] = 1;
        vector<long long> usd(n);
        for (long long j = 0; j < (n); ++j) {
          if (done[j]) usd[j] = 1;
        }
        long long mx;
        usd[i] = 1;
        while (prc[i] > 0) {
          mx = -1;
          for (long long j = 0; j < (n); ++j) {
            if (!usd[j]) mx = max(mx, lft[j]);
          }
          assert(mx > -1);
          for (long long j = 0; j < (n); ++j) {
            if (!usd[j] && lft[j] == mx) {
              --lft[j];
              --prc[i];
              usd[j] = 1;
              rs[i][j] = 1;
              break;
            }
          }
        }
        for (long long j = 0; j < (n); ++j) {
          if (!usd[j]) {
            --lft[i];
            rs[j][i] = 1;
            --prc[j];
          }
        }
        break;
      }
    }
  }
  for (long long i = 0; i < (n); ++i) {
    for (long long j = 0; j < (n); ++j) {
      cout << rs[i][j];
    }
    cout << endl;
  }
  return 0;
}
