#include <bits/stdc++.h>
using namespace std;
const int N = 4005;
struct Edge {
  int v, c;
  Edge(int _v, int _c) : v(_v), c(_c) {}
};
vector<Edge> E;
vector<int> g[N];
void addEdge(int u, int v, int c) {
  g[u].emplace_back((int)E.size());
  E.emplace_back(v, c);
  g[v].emplace_back((int)E.size());
  E.emplace_back(u, 0);
}
int S, T;
int d[N];
int p[N];
bool bfs() {
  for (int i = 0; i <= T; ++i) d[i] = -1, p[i] = 0;
  queue<int> q;
  q.push(S);
  d[S] = 0;
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int i : g[u]) {
      int v = E[i].v;
      if (E[i].c == 0) continue;
      if (d[v] < 0) {
        d[v] = d[u] + 1;
        q.push(v);
      }
    }
  }
  return d[T] >= 0;
}
int dfs(int u, int F) {
  if (u == T || F == 0) return F;
  for (int &i = p[u]; i < (int)g[u].size(); ++i) {
    int j = g[u][i];
    int v = E[j].v;
    if (E[j].c == 0 || d[v] != d[u] + 1) continue;
    int res = dfs(v, min(E[j].c, F));
    if (res) {
      E[j].c -= res;
      j ^= 1;
      E[j].c += res;
      return res;
    }
  }
  return 0;
}
int MaxFlow() {
  while (bfs())
    while (dfs(S, N))
      ;
  int ans = 0;
  for (int i : g[T]) ans += E[i].c;
  return ans;
}
bool f[65][65][2005];
int a[65];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int m = -1;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int P = a[n] + 1; P <= 2 * a[n] + 1; ++P) {
    memset(f, 0, sizeof f);
    f[0][0][0] = 1;
    for (int i = 0; i < P; ++i)
      for (int j = 0; j <= n; ++j)
        for (int s = i * (i - 1) / 2; s <= P * (P - 1) / 2; ++s)
          if (f[i][j][s]) {
            if (j > 0) f[i + 1][j][s + a[j]] = 1;
            ++j;
            if (j <= n) f[i + 1][j][s + a[j]] = 1;
            --j;
          }
    if (f[P][n][P * (P - 1) / 2]) {
      m = P;
      break;
    }
  }
  if (m < 0) {
    cout << "=(";
    return 0;
  }
  int lst = n;
  int sum = m * (m - 1) / 2;
  vector<int> deg = {0};
  for (int i = m - 1; i >= 0; --i) {
    sum -= a[lst];
    deg.emplace_back(a[lst]);
    assert(sum >= i * (i - 1) / 2);
    if (!f[i][lst][sum]) lst--;
  }
  S = 0;
  T = N - 1;
  for (int i = 1; i <= m; ++i)
    if (deg[i]) {
      addEdge(S, i, deg[i]);
      for (int j = 1; j <= m; ++j) {
        int x = i * m + j;
        int y = j * m + i;
        if (i < j) addEdge(i, x, 1), addEdge(x, T, 1);
        if (i > j) addEdge(i, y, 1);
      }
    }
  assert(MaxFlow() == m * (m - 1) / 2);
  vector<vector<int> > adj(m, vector<int>(m, 0));
  for (int i = 0; i < (int)E.size(); i += 2) {
    if (E[i].v == T) continue;
    if (E[i].v <= m) continue;
    if (E[i ^ 1].c) {
      int u = (E[i].v - m - 1) / m;
      int v = (E[i].v - m - 1) % m;
      if (E[i ^ 1].v == v + 1) swap(u, v);
      adj[u][v] = 1;
    }
  }
  cout << m << "\n";
  for (int i = 0; i < m; ++i, cout << "\n")
    for (int j = 0; j < m; ++j) cout << adj[i][j];
}
