#include <bits/stdc++.h>
using namespace std;
const int N = 62;
int n, a[N];
int f[N][N][N * N];
int last[N][N][N * N][2];
int e[N][N], s[N], u[N], has;
void out() {
  for (int i = 1; i <= has; i++) {
    for (int j = 1; j <= has; j++) printf("%d", e[i][j]);
    printf("\n");
  }
}
pair<int, int> px[N];
int tu[N];
bool same() {
  memcpy(tu, u, sizeof u);
  sort(tu + 1, tu + 1 + n);
  for (int i = 1; i <= has; i++)
    if (tu[i] != s[i]) return 0;
  return 1;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  f[0][0][0] = 1;
  int ans = 0;
  has = 0;
  for (int i = 0; i < 62; i++) {
    if (f[i][n][i * (i - 1) / 2] && a[n] < i) {
      has = i;
      break;
    }
    for (int j = 0; j <= n; j++) {
      for (int s = (i - 1) * i / 2; s <= 30 * i; s++)
        if (f[i][j][s]) {
          if (j != 0) {
            f[i + 1][j][s + a[j]] = 1;
            last[i + 1][j][s + a[j]][0] = j;
            last[i + 1][j][s + a[j]][1] = s;
          }
          f[i + 1][j + 1][s + a[j + 1]] = 1;
          last[i + 1][j + 1][s + a[j + 1]][0] = j;
          last[i + 1][j + 1][s + a[j + 1]][1] = s;
        }
    }
  }
  if (has == 0)
    printf("=(");
  else {
    cout << has << endl;
    int g1 = n, g2 = has * (has - 1) / 2;
    for (int i = has; i; i--) {
      s[i] = g2 - last[i][g1][g2][1];
      int gg1 = g1, gg2 = g2;
      g1 = last[i][gg1][gg2][0];
      g2 = last[i][gg1][gg2][1];
    }
    int dis = 0;
    for (int i = 1; i <= has; i++) {
      for (int j = 1; j < i; j++) e[i][j] = 1;
      u[i] = i - 1;
      dis += abs(s[i] - u[i]);
    }
    for (; dis; dis -= 2) {
      for (int i = 1; i <= has; i++) px[i] = make_pair(u[i], i);
      sort(px + 1, px + 1 + has);
      for (int i = 1; i <= has; i++)
        if (s[i] > px[i].first) {
          for (int j = i + 1; j <= has; j++)
            if (s[j] < px[j].first) {
              for (int z = 1; z <= has; z++) {
                if (e[px[j].second][px[z].second] &&
                    e[px[z].second][px[i].second]) {
                  e[px[j].second][px[z].second] ^= 1,
                      e[px[z].second][px[j].second] ^= 1;
                  e[px[i].second][px[z].second] ^= 1,
                      e[px[z].second][px[i].second] ^= 1;
                  u[px[j].second]--;
                  u[px[i].second]++;
                  break;
                }
              }
              break;
            }
          break;
        }
    }
    sort(u + 1, u + 1 + has);
    for (int i = 1; i <= has; i++) {
      for (int j = 1; j <= has; j++) printf("%d", e[i][j]);
      printf("\n");
    }
  }
}
