Problem: Ivan is reading a book about tournaments. He knows that a tournament is an oriented graph with exactly one oriented edge between each pair of vertices. The score of a vertex is the number of edges going outside this vertex. 

Yesterday Ivan learned Landau's criterion: there is tournament with scores d1 ≤ d2 ≤ ... ≤ dn if and only if <image> for all 1 ≤ k < n and <image>.

Now, Ivan wanna solve following problem: given a set of numbers S = {a1, a2, ..., am}, is there a tournament with given set of scores? I.e. is there tournament with sequence of scores d1, d2, ..., dn such that if we remove duplicates in scores, we obtain the required set {a1, a2, ..., am}? 

Find a tournament with minimum possible number of vertices. 

Input

The first line contains a single integer m (1 ≤ m ≤ 31).

The next line contains m distinct integers a1, a2, ..., am (0 ≤ ai ≤ 30) — elements of the set S. It is guaranteed that all elements of the set are distinct.

Output

If there are no such tournaments, print string "=(" (without quotes).

Otherwise, print an integer n — the number of vertices in the tournament.

Then print n lines with n characters — matrix of the tournament. The j-th element in the i-th row should be 1 if the edge between the i-th and the j-th vertices is oriented towards the j-th vertex, and 0 otherwise. The main diagonal should contain only zeros.

Examples

Input

2
1 2


Output

4
0011
1001
0100
0010


Input

2
0 3


Output

6
000111
100011
110001
011001
001101
000000

Solution (in CPP):

Solution:
#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;
}