#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e6 + 10;
using namespace std;
struct E {
  int k, c;
  E() {}
  E(int _k, int _c) : k(_k), c(_c) {}
} es[4200010];
struct Flow {
  int n, m, dis[500010];
  int qq[500010], qr, ql;
  vector<int> e[500010];
  void init(int _n) {
    n = _n;
    m = 0;
    for (int i = 0; i < n; i++) e[i] = vector<int>();
  }
  void add_edge(int a, int b, int c) {
    e[a].push_back(m);
    es[m] = E(b, c);
    m++;
    e[b].push_back(m);
    es[m] = E(a, 0);
    m++;
  }
  bool BFS() {
    memset(dis, -1, n * sizeof(int));
    ql = qr = 0;
    qq[qr++] = 0;
    dis[0] = 0;
    while (ql != qr && dis[n - 1] == -1) {
      int p = qq[ql++];
      for (__typeof((e[p]).begin()) it = (e[p]).begin(); it != (e[p]).end();
           it++) {
        E ee = es[*it];
        if (ee.c == 0 || dis[ee.k] != -1) continue;
        dis[ee.k] = dis[p] + 1;
        qq[qr++] = ee.k;
      }
    }
    return dis[n - 1] != -1;
  }
  long long go(int p, long long c) {
    if (p == n - 1) return c;
    long long ret = 0, tmp;
    for (__typeof((e[p]).begin()) it = (e[p]).begin(); it != (e[p]).end();
         it++) {
      E &ee = es[*it];
      if (ee.c == 0 || dis[p] + 1 != dis[ee.k]) continue;
      tmp = go(ee.k, min(c - ret, (long long)ee.c));
      ret += tmp;
      ee.c -= tmp;
      es[(*it) ^ 1].c += tmp;
      if (ret == c) break;
    }
    if (ret == 0) dis[p] = -1;
    return ret;
  }
  long long maxflow() {
    long long ret = 0;
    while (BFS()) ret += go(0, 1LL << 60);
    return ret;
  }
} flow;
int C2[100];
int dp[32][2000][62], a[31];
int rn;
pair<int, int> rd[100000];
char an[65][65];
void go(int m, int ss, int nn) {
  printf("%d\n", nn);
  vector<int> d;
  while (m) {
    int u = dp[m][ss][nn];
    m--;
    for (int i = 0; i < (u); ++i) d.push_back(a[m]);
    ss -= u * a[m];
    nn -= u;
  }
  int n = ((int)(d).size());
  int ed = 1 + C2[((int)(d).size())] + ((int)(d).size());
  flow.init(ed + 1);
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (i); ++j) {
      rn++;
      rd[rn] = make_pair(j, i);
      flow.add_edge(0, rn, 1);
      flow.add_edge(rn, C2[((int)(d).size())] + i + 1, 1);
      flow.add_edge(rn, C2[((int)(d).size())] + j + 1, 1);
    }
  for (int i = 0; i < (((int)(d).size())); ++i) {
    flow.add_edge(C2[((int)(d).size())] + i + 1, ed, d[i]);
  }
  flow.maxflow();
  for (int i = 0; i < (((int)(d).size())); ++i)
    for (int j = 0; j < (((int)(d).size())); ++j) an[i][j] = '0';
  for (int i = 0; i < flow.m; i += 2) {
    int x = es[i + 1].k;
    int y = es[i].k;
    if (x <= C2[((int)(d).size())] && y > C2[((int)(d).size())] && !es[i].c) {
      int from = y - C2[((int)(d).size())] - 1;
      int to = rd[x].first + rd[x].second - from;
      an[y - C2[((int)(d).size())] - 1][to] = '1';
    }
  }
  for (int i = 0; i < (((int)(d).size())); ++i) puts(an[i]);
}
int main() {
  for (int i = 0; i < (100); ++i) C2[i] = i * (i - 1) / 2;
  int(m);
  scanf("%d", &m);
  for (int i = 0; i < (m); ++i) scanf("%d", &(a[i]));
  sort(a, a + m);
  dp[0][0][0] = 1034567890;
  for (int i = 0; i < (m); ++i) {
    int r = m - i - 1;
    for (int ss = 0; ss < (2000); ++ss)
      for (int nn = 0; nn < (62); ++nn) {
        if (!dp[i][ss][nn]) continue;
        int now_ss = ss;
        for (int k = 1; k + nn + r <= 61; k++) {
          now_ss += a[i];
          if (now_ss >= C2[k + nn]) {
            dp[i + 1][now_ss][k + nn] = k;
          } else
            break;
        }
      }
  }
  for (int i = 1; i <= 61; i++) {
    if (dp[m][C2[i]][i]) {
      go(m, C2[i], i);
      return 0;
    }
  }
  return 0 * puts("=(");
}
