#include <bits/stdc++.h>
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T, class U>
inline void print(T first, U second) {
  printsp(first);
  println(second);
}
template <class T, class U, class V>
inline void print(T first, U second, V z) {
  printsp(first);
  printsp(second);
  println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
const int N = 77, M = 3333;
int d[N][M][N], t[N][M][N], s[N], n, ans[N][N], Max;
pair<int, int> p[N];
bool cmp(pair<int, int> u, pair<int, int> v) { return u.second < v.second; }
void put(int m) {
  int a = m, b = m * (m - 1) / 2, c = n, cnt = 0;
  println(m);
  while (a) {
    cnt++;
    p[cnt].first = cnt;
    p[cnt].second = s[c];
    int tmp = t[a][b][c];
    a--;
    b -= s[c];
    c -= tmp;
  }
  for (int i = 1; i <= m; i++, cnt--) {
    sort(p + 1, p + cnt + 1, cmp);
    int first = p[cnt].first, second = p[cnt].second;
    for (int j = 1; j < cnt; j++) {
      if (j <= second)
        ans[first][p[j].first] = 1;
      else
        ans[p[j].first][first] = 1, p[j].second--;
    }
  }
  for (int i = 1; i <= m; i++, puts(""))
    for (int j = 1; j <= m; j++) print(ans[i][j]);
  return;
}
bool nam(int m) {
  memset(d, 0, sizeof d);
  d[0][0][0] = 1;
  for (int i = 0; i < m; i++) {
    int st = i * (i - 1) / 2, ed = min(m * (m - 1) / 2, i * (m - 1)) + 1;
    for (int j = st; j < ed; j++)
      for (int k = 0; k <= n; k++)
        if (d[i][j][k]) {
          if (k > 0) {
            d[i + 1][j + s[k]][k] = 1;
            t[i + 1][j + s[k]][k] = 0;
          }
          if (k < n) {
            d[i + 1][j + s[k + 1]][k + 1] = 1;
            t[i + 1][j + s[k + 1]][k + 1] = 1;
          }
        }
  }
  if (!d[m][m * (m - 1) / 2][n]) return true;
  put(m);
  return false;
}
void solve() {
  gn(n);
  for (int i = 1; i <= n; smax(Max, s[i]), i++) gn(s[i]);
  sort(s + 1, s + n + 1);
  int i = Max + 1;
  for (sort(s + 1, s + n + 1); nam(i); i++)
    if (i == 62) {
      puts("=(");
      return;
    }
  exit(0);
}
int main() {
  solve();
  return 0;
}
