#include <bits/stdc++.h>
using namespace std;
using cd = complex<double>;
const long long INF = 1e15;
const int mod = 1e9 + 7;
const double Pi = acos(-1);
void Fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int n;
vector<pair<int, int> > V, Eq;
int ans[1005][1005];
bool Unique[1005];
signed main() {
  Fastio();
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    V.emplace_back(a, i);
  }
  sort(V.begin(), V.end());
  int res = V.back().first + 1;
  cout << res << '\n';
  Eq.emplace_back(0, res - 1);
  while (V.size()) {
    vector<pair<int, int> > Tmp;
    int tmp = V.back().first, pos = V.back().second;
    int first = 0;
    V.pop_back();
    for (auto x : Eq) {
      if (x.first > x.second) {
        continue;
      }
      if (x.first == x.second) {
        Unique[x.first] = true;
        continue;
      } else {
        if (first == 0) {
          int l = x.first, r = x.second;
          int nxt = min(l + tmp - 1, r - 1);
          first = 1;
          for (int i = l; i <= nxt; i++) {
            ans[i][pos] = 1;
            tmp--;
          }
          Tmp.emplace_back(l, nxt);
          Tmp.emplace_back(nxt + 1, r);
        } else {
          int l = x.first;
          while (l != x.second + 1 && tmp > 0) {
            ans[l][pos] = 1;
            tmp--;
            l++;
          }
          Tmp.emplace_back(x.first, l - 1);
          Tmp.emplace_back(l, x.second);
        }
      }
    }
    Eq = Tmp;
    if (tmp) {
      for (int i = 0; i < res; i++) {
        if (Unique[i] && tmp > 0) {
          tmp--;
          ans[i][pos] = 1;
        }
      }
    }
    assert(tmp == 0);
  }
  for (int i = 0; i < res; i++) {
    for (int j = 0; j < n; j++) {
      cout << ans[i][j];
    }
    cout << '\n';
  }
}
