#include <bits/stdc++.h>
using namespace std;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const long long MAXN = 1e6 + 10;
const long long INF = 8e18;
const long long MOD = 1e9 + 7;
int n;
vector<pair<int, int>> v, vt;
vector<vector<bool>> ans, ans2;
bool DEBUG_MODE;
inline bool BET(int l, int r, int m) {
  m--;
  return m >= l && m <= r;
}
inline void Majik(int L, int R) {
  vt = v;
  int ptr = R;
  for (int i = L; i <= R; i++) {
    ans.push_back({});
    ans.rbegin()->resize(n);
    for (int j = L; j <= min(R, n - 1); j++) {
      if (v[j].first >= i - L) ans[i][j] = 1;
    }
    for (int j = R + 1; j < n; j++) {
      if (v[j].first > 1) {
        ans[i][j] = 1;
        v[j].first--;
      }
    }
  }
  for (int i = min(R, n - 1); i >= L; i--) {
    ptr = min(ptr, L + v[i].first + 1);
    ans[ptr][i] = 0;
    ptr--;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back({x, i});
    if (n == 1000 && i == 1 && v.back().first == 7) DEBUG_MODE = true;
  }
  sort((v).begin(), (v).end());
  int L = 0;
  for (int i = 0; i < n; i++) {
    if (v[i].first < i + 1 - L) {
      Majik(L, i);
      L = i + 1;
    }
  }
  Majik(L, n);
  for (int i = 0; i < (int)ans.size(); i++) {
    if (find((ans[i]).begin(), (ans[i]).end(), true) == ans[i].end()) continue;
    ans2.push_back({});
    ans2.rbegin()->resize(n);
    for (int j = 0; j < n; j++) ans2[ans2.size() - 1][v[j].second] = ans[i][j];
  }
  cout << ans2.size() << '\n';
  for (auto e : ans2) {
    for (auto e2 : e) {
      cout << int(e2);
    }
    cout << '\n';
  }
  return 0;
}
