#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 33;
const int MAXM = 63;
const int MAXS = MAXM * MAXM;
struct aT {
  aT() : id(0), win(0) {}
  bool operator<(const aT &a) const { return id < a.id; }
  int id;
  vector<int> win;
};
int n;
int a[MAXN];
bool dp[MAXM][MAXN][MAXS];
int pre[MAXM][MAXN][MAXS];
bool win[MAXM][MAXM];
void init();
void input();
void work();
void print(int ans);
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
}
void work() {
  sort(a + 1, a + 1 + n);
  dp[0][0][0] = true;
  int ns, ps;
  for (int i = 1; i < MAXM; ++i) {
    ps = (i - 1) * (i - 2) >> 1;
    ns = i * (i - 1) >> 1;
    for (int j = 0; j <= n; ++j) {
      for (int k = ps; k < MAXS; ++k) {
        if (dp[i - 1][j][k]) {
          if (j && (k + a[j]) >= ns)
            dp[i][j][k + a[j]] = true, pre[i][j][k + a[j]] = j;
          if ((j ^ n) && (k + a[j + 1]) >= ns)
            dp[i][j + 1][k + a[j + 1]] = true, pre[i][j + 1][k + a[j + 1]] = j;
        }
      }
    }
    if (dp[i][n][ns]) {
      print(i);
      return;
    }
  }
  printf("=(\n");
}
void print(int ans) {
  printf("%d\n", ans);
  int nk = ans * (ans - 1) >> 1, tk;
  int nj = n;
  vector<pair<int, aT> > ar;
  for (int i = ans; i > 0; --i) {
    ar.push_back(make_pair(a[nj], aT()));
    tk = nk;
    nk -= a[nj];
    nj = pre[i][nj][tk];
  }
  reverse(ar.begin(), ar.end());
  for (int i = 0; i < ans; ++i) ar[i].second.id = i;
  for (int i = 0; i < ans; ++i) {
    sort(ar.begin() + i, ar.end());
    for (int j = 1; j <= ar[i].first; ++j)
      ar[i].second.win.push_back(ar[j + i].second.id);
    for (int j = i + ar[i].first + 1; j < ans; ++j)
      ar[j].second.win.push_back(ar[i].second.id), --ar[j].first;
  }
  for (int i = 0; i < ans; ++i) {
    for (auto x : ar[i].second.win) win[ar[i].second.id][x] = true;
  }
  for (int i = 0; i < ans; ++i) {
    for (int j = 0; j < ans; ++j) putchar(win[i][j] ? '1' : '0');
    putchar('\n');
  }
}
