#include <bits/stdc++.h>
using namespace std;
template <class T>
void dumpBetween(const T& a, const T& b) {
  for (T it = a; it != b; it++) cout << *it << " ";
  cout << endl;
}
template <class T>
void dumpAll(const T& a) {
  dumpBetween((a).begin(), (a).end());
}
template <class T>
void minify(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void maxify(T& a, const T& b) {
  if (a < b) a = b;
}
const int N = 33;
int dp[35][70][3000];
int n;
int a[N];
int solve() {
  for (int j = 1; j < ((int)70); j++) {
    int i = 0;
    int k = j * a[0];
    if (k >= j * (j - 1) / 2) {
      dp[0][j][j * a[0]] = j;
      if (i == n - 1 && k == j * (j - 1) / 2 && dp[i][j][k] > 0) {
        return j;
      }
    }
  }
  for (int i = 1; i < ((int)n); i++) {
    for (int j = 1; j < ((int)70); j++) {
      for (int k = j * (j - 1) / 2; k < ((int)3000); k++) {
        int prev = k - a[i];
        if (prev >= 0) {
          if (dp[i - 1][j - 1][prev] > 0) {
            dp[i][j][k] = 1;
          } else if (dp[i][j - 1][prev] > 0) {
            dp[i][j][k] = dp[i][j - 1][prev] + 1;
          }
        }
        if (i == n - 1 && k == j * (j - 1) / 2 && dp[i][j][k] > 0) {
          return j;
        }
      }
    }
  }
  return 0;
}
vector<int> exemplifyDegrees(int j) {
  int i = n - 1;
  int rest = j * (j - 1) / 2;
  vector<int> ret;
  while (true) {
    int curCount = dp[i][j][rest];
    assert(curCount > 0);
    for (int _108 = 0; _108 < ((int)curCount); _108++) {
      ret.push_back(a[i]);
      rest -= a[i];
      j -= 1;
    }
    assert(rest >= 0);
    if (i == 0) {
      assert(rest == 0);
      return ret;
    }
    i--;
  }
}
int winsSoFar[80];
int lossesSoFar[80];
char output[80][80];
int main() {
  scanf("%d", &(n));
  for (int i = 0; i < ((int)n); i++) scanf("%d", &(a[i]));
  sort(a, a + n);
  int j = solve();
  if (j == 0) {
    puts("=(");
  } else {
    vector<int> degs = exemplifyDegrees(j);
    sort((degs).begin(), (degs).end());
    int s = degs.size();
    printf("%d\n", s);
    for (int i = 0; i < ((int)s); i++) {
      output[i][i] = '0';
    }
    for (int i = 0; i < ((int)s); i++) {
      vector<int> later;
      for (int j = i + 1; j < ((int)s); j++) {
        later.push_back(j);
      }
      sort((later).begin(), (later).end(), [&](int j1, int j2) {
        return (s - 1 - degs[j1] - lossesSoFar[j1]) >
               (s - 1 - degs[j2] - lossesSoFar[j2]);
      });
      int neededWins = degs[i] - winsSoFar[i];
      for (int jj = 0; jj < later.size(); jj++) {
        int j = later[jj];
        if (jj < neededWins) {
          assert(lossesSoFar[j] < s - 1 - degs[j]);
          output[i][j] = '1';
          output[j][i] = '0';
          winsSoFar[i]++;
          lossesSoFar[j]++;
        } else {
          assert(winsSoFar[j] < degs[j]);
          output[i][j] = '0';
          output[j][i] = '1';
          winsSoFar[j]++;
          lossesSoFar[i]++;
        }
      }
      puts(output[i]);
    }
  }
}
