#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmax(T& x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T& x) {
  char c;
  int sign = 1;
  x = 0;
  do {
    c = getchar();
    if (c == '-') sign = -1;
  } while (!isdigit(c));
  do {
    x = x * 10 + c - '0';
    c = getchar();
  } while (isdigit(c));
  x *= sign;
}
inline void init(string name) {
  string in = name + ".in", out = name + ".out";
  freopen(in.c_str(), "r", stdin);
  freopen(out.c_str(), "w", stdout);
}
const int N = 62;
int m, mx, a[N];
bool f[N][2 * N][N * N << 1];
bool g[N][2 * N][N * N << 1];
int cnt, mp[2 * N][2 * N];
struct DATA {
  int w, id;
} w[N * 2];
inline bool cmp(DATA a, DATA b) { return a.w < b.w; }
bool vis[N << 1];
inline void solve(int x) {
  printf("%d\n", x);
  int z = x * (x - 1) / 2;
  while (x) {
    w[++cnt].w = a[m];
    w[cnt].id = cnt;
    g[m][x][z] ? z -= a[m] : z -= a[m--];
    --x;
  }
  for (register int i = 2; i <= cnt; ++i) {
    sort(w + 1, w + 1 + cnt, cmp);
    int x = 1;
    while (vis[w[x].id] && x < cnt) ++x;
    for (register int j = 1; j <= cnt; ++j)
      if (!mp[w[x].id][w[j].id] && !mp[w[j].id][w[x].id] && x != j)
        w[x].w ? (mp[w[x].id][w[j].id] = 1, w[x].w--)
               : (mp[w[j].id][w[x].id] = 1, w[j].w--);
    vis[w[x].id] = 1;
  }
  for (register int i = 1; i <= cnt; ++i) {
    for (register int j = 1; j <= cnt; ++j) printf("%d", mp[i][j]);
    puts("");
  }
}
int main() {
  read(m);
  for (register int i = 1; i <= m; ++i) read(a[i]), chkmax(mx, a[i]);
  sort(a + 1, a + 1 + m);
  f[0][0][0] = 1;
  int z = 121 * 120 / 2;
  for (register int i = 1; i <= m; ++i)
    for (register int j = 1; j <= 121; ++j)
      for (register int k = (j - 1) * (j - 2) / 2 + a[i]; k <= 60 * j + a[i];
           ++k)
        if (f[i - 1][j - 1][k - a[i]])
          f[i][j][k] = 1;
        else if (f[i][j - 1][k - a[i]])
          f[i][j][k] = 1, g[i][j][k] = 1;
  for (register int i = m; i <= 121; ++i)
    if (f[m][i][i * (i - 1) / 2]) return solve(i), 0;
  puts("No solution");
  return 0;
}
