#include <bits/stdc++.h>
using namespace std;
const int iinf = 1e9 + 10;
const long long inf = 1ll << 60;
const long long mod = 1e9 + 7;
void GG() {
  cout << "0\n";
  exit(0);
}
long long mpow(long long a, long long n, long long mo = mod) {
  long long re = 1;
  while (n > 0) {
    if (n & 1) re = re * a % mo;
    a = a * a % mo;
    n >>= 1;
  }
  return re;
}
long long inv(long long b, long long mo = mod) {
  if (b == 1) return b;
  return (mo - mo / b) * inv(mo % b, mo) % mo;
}
const int maxn = 1e3 + 5;
char g[maxn][maxn];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> a(n);
  vector<pair<int, int> > pp;
  for (int i = 0; i < n; ++i) cin >> a[i], pp.push_back({a[i], i});
  sort(pp.begin(), pp.end());
  sort(a.begin(), a.end());
  for (int i = 0; i < n + 1; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == 0)
        g[i][j] = '1';
      else {
        g[i][j] = (i - 1 == j) ? '0' : '1';
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n - a[i]; ++j) {
      g[(i + 2 + j) % (n + 1)][i] = '0';
    }
  }
  vector<string> out;
  for (int i = 0; i < n + 1; ++i) {
    string tmp = "";
    bool hi = 0;
    for (int j = 0; j < n; ++j) {
      if (g[i][j] != '0') hi = 1;
      tmp += g[i][j];
    }
    if (hi) {
      if ((int)out.size() && tmp == out[0]) {
        ;
        for (string &y : out) {
          bool ok = 1;
          for (int j = 0; j < n; ++j) {
            if (tmp[j] == '1' && y[j] == '1') {
              ok = 0;
              break;
            }
          }
          if (ok) {
            ;
            ;
            for (int j = 0; j < n; ++j) {
              if (tmp[j] == '1') y[j] = '1';
            }
            break;
          }
        }
      } else {
        out.push_back(tmp);
      }
    }
  }
  cout << (int)out.size() << '\n';
  for (string second : out) {
    vector<char> hi(n);
    for (int i = 0; i < n; ++i) {
      hi[pp[i].second] = second[i];
    }
    for (char c : hi) cout << c;
    cout << '\n';
  }
}
