#include <bits/stdc++.h>
unsigned A[111], Ai, Q[111], Qi, Ri;
char R[11111][111];
unsigned F() {
  unsigned i, m, m2, d;
  Qi = m = m2 = d = 0;
  for (i = -1; ++i < Ai;) {
    if (A[i] == m)
      Q[Qi++] = i;
    else if (A[i] > m) {
      m = A[i];
      Q[0] = i;
      Qi = 1;
    }
  }
  if (Qi == Ai) return 0;
  if (Qi == 1) {
    for (i = -1; ++i < Ai;)
      if (A[i] < m && A[i] >= m2) m2 = A[d = i];
    Q[Qi++] = d;
  }
  return 1;
}
int main() {
  unsigned i = -1, k;
  for (scanf("%u", &Ai); ++i < Ai;) scanf("%u", A + i);
  for (; F(); ++Ri) {
    for (i = -1; ++i < Ai;) R[Ri][i] = '0';
    if (Qi > 6)
      k = 5;
    else if (Qi == 6)
      k = 4;
    else
      k = Qi;
    for (i = -1; ++i < k;) {
      R[Ri][Q[i]] = '1';
      if (A[Q[i]]) --A[Q[i]];
    }
  }
  printf("%u\n%u\n", *A, Ri);
  while (Ri) printf("%s\n", R[--Ri]);
  return 0;
}
