#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int n, a[maxn], tot;
vector<int> id;
char s[maxn][maxn];
inline int check() {
  bool fl = 0;
  vector<int> res;
  res.clear();
  for (auto x : id)
    if (a[x] > 0)
      res.push_back(x);
    else
      fl = 1;
  id = res;
  return fl;
}
inline bool cmp(const int &x, const int &y) { return a[x] < a[y]; }
inline void solve() {
  if (check()) return;
  sort(id.begin(), id.end(), cmp);
  bool fl = 0;
  if (a[id[0]] > 1 || a[id.back()] == 1) {
    tot++;
    for (int i = 1; i <= n; i++) s[tot][i] = '0';
    for (auto x : id) a[x]--, s[tot][x] = '1';
    fl = 1;
    if (check()) return;
  }
  if (a[id[0]] == a[id.back()] && a[id[0]] == (int)id.size() - 1) {
    for (auto x : id) {
      tot++;
      for (int i = 1; i <= n; i++) s[tot][i] = '0';
      for (auto y : id)
        if (y != x) a[y]--, s[tot][y] = '1';
    }
    check();
    return;
  }
  int k;
  for (k = 1; k < (int)id.size(); k++) {
    if (a[id[0]] == 1) break;
    tot++;
    for (int i = 1; i <= n; i++) s[tot][i] = '0';
    for (auto y : id)
      if (y != id[k]) a[y]--, s[tot][y] = '1';
    if (check()) return;
  }
  tot++;
  for (int i = 1; i <= n; i++) s[tot][i] = '0';
  int y = (fl && a[id[k]] > 1) ? id[k] : 0;
  for (auto x : id)
    if ((x == id[0] || a[x] > 1) && x != y) a[x]--, s[tot][x] = '1';
  check();
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), id.push_back(i);
  while (!id.empty()) solve();
  printf("%d\n", tot);
  for (int i = 1; i <= tot; i++) printf("%s\n", s[i] + 1);
  return 0;
}
