#include <bits/stdc++.h>
using namespace std;
const int MAX_M = 40;
const int MAX_N = 70;
bool memo[MAX_N][32][32 * MAX_N];
short mark[MAX_N][32][32 * MAX_N];
short parent[MAX_N][32][32 * MAX_N];
int arr[MAX_M];
int n, m;
short pass = 1;
bool mat[MAX_N][MAX_N];
int out[MAX_N];
const int INF = 1e9;
bool roll(int pos, int idx, int sum) {
  if (pos == n + 1) {
    return idx == m + 1 && sum == (1LL * n * (n - 1)) / 2LL;
  } else if (idx == m + 1) {
    return false;
  }
  bool &ans = memo[pos][idx][sum];
  if (mark[pos][idx][sum] == pass) {
    return ans;
  }
  mark[pos][idx][sum] = pass;
  if (sum + arr[idx] >= (1LL * pos * (pos - 1)) / 2) {
    if (roll(pos + 1, idx, sum + arr[idx])) {
      ans = true;
      parent[pos][idx][sum] = idx;
    } else if (roll(pos + 1, idx + 1, sum + arr[idx])) {
      ans = true;
      parent[pos][idx][sum] = idx + 1;
    }
  }
  return ans;
}
int main() {
  scanf("%d", &m);
  for (int i = int(1); i < int(m + 1); i++) {
    scanf("%d", arr + i);
  }
  sort(arr + 1, arr + m + 1);
  memset(parent, -1, sizeof parent);
  int ans = -1;
  for (int i = m; i <= 100 && ans == -1; i++) {
    n = i;
    bool ok = roll(1, 1, 0);
    if (ok) {
      ans = i;
    }
    pass++;
  }
  if (ans == -1) {
    puts("=(");
    return 0;
  }
  tuple<int, int, int> cur = tuple<int, int, int>(1, 1, 0);
  vector<int> els;
  while (get<0>(cur) <= n) {
    int pos, idx, sum;
    tie(pos, idx, sum) = cur;
    els.push_back(arr[idx]);
    tuple<int, int, int> nxt =
        tuple<int, int, int>(pos + 1, parent[pos][idx][sum], sum + arr[idx]);
    cur = nxt;
  }
  set<pair<int, int> > order;
  for (int i = int(0); i < int(n); i++) {
    out[i] = els[i];
    order.emplace(out[i], i);
  }
  n = ans;
  for (int i = int(0); i < int(n); i++) {
    pair<int, int> p = *order.begin();
    order.erase(order.begin());
    vector<pair<int, int> > to_update;
    for (auto &each : order) {
      if (out[p.second] > 0) {
        out[p.second]--;
        mat[p.second][each.second] = true;
      } else {
        out[each.second]--;
        mat[each.second][p.second] = true;
      }
      to_update.emplace_back(out[each.second], each.second);
    }
    order.clear();
    for (auto &each : to_update) {
      order.insert(each);
    }
  }
  printf("%d\n", ans);
  for (int i = int(0); i < int(n); i++) {
    for (int j = int(0); j < int(n); j++) {
      printf("%d", (int)mat[i][j]);
    }
    puts("");
  }
  return 0;
}
