#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> dat(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &dat[i]);
  }
  vector<string> ans(n + 1);
  vector<int> group(n + 1);
  vector<int> grpcnt(n + 1);
  vector<int> temp(n + 1);
  vector<int> newgrp(n + 1);
  for (int i = 0; i < n; i++) {
    fill(grpcnt.begin(), grpcnt.end(), 0);
    for (int j = 0; j < n + 1; j++) {
      grpcnt[group[j]]++;
    }
    int lastgrp = 0;
    for (int j = 0; j <= n; j++)
      if (grpcnt[j] > 0) lastgrp = j;
    int largest_group = 0;
    for (int j = 1; j < n + 1; j++)
      if (grpcnt[largest_group] < grpcnt[j]) largest_group = j;
    int rem = dat[i];
    fill(temp.begin(), temp.end(), 0);
    if (rem < grpcnt[largest_group]) {
      temp[largest_group] = rem;
      rem = 0;
    } else {
      temp[largest_group] = grpcnt[largest_group] - 1;
      rem -= grpcnt[largest_group] - 1;
    }
    for (int j = 0; j <= n; j++) {
      if (j == largest_group) continue;
      int val = min(grpcnt[j], rem);
      temp[j] = val;
      rem -= val;
    }
    for (int j = 0; j <= n; j++) {
      if (temp[j] > 0 && temp[j] < grpcnt[j]) {
        newgrp[j] = ++lastgrp;
      } else {
        newgrp[j] = -1;
      }
    }
    for (int j = 0; j <= n; j++) {
      if (temp[group[j]] > 0) {
        temp[group[j]]--;
        ans[j].push_back('1');
      } else {
        ans[j].push_back('0');
        if (newgrp[group[j]] != -1) {
          group[j] = newgrp[group[j]];
        }
      }
    }
  }
  printf("%d\n", ans.size());
  for (const auto &s : ans) {
    printf("%s\n", s.c_str());
  }
  return 0;
}
