#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 1e8;
const int MOD = 1e9 + 7;
const int MAXSIZE = 1e6 + 5;
const double eps = 0.0000000001;
void fre() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
const int MSIZE = 110;
struct Node {
  int id, value;
} arr[MSIZE];
bool cmp(Node a, Node b) { return a.value > b.value; }
int ans[10000][MSIZE];
int main() {
  int n;
  while (scanf("%d", &n) + 1) {
    memset(ans, 0, sizeof(ans));
    for (int i = 0; i < n; i++) scanf("%d", &arr[i].value), arr[i].id = i;
    int tot = 0;
    while (1) {
      sort(arr, arr + n, cmp);
      if (arr[0].value == arr[n - 1].value) break;
      if (arr[0].value == arr[1].value && arr[1].value == arr[2].value &&
          arr[3].value == arr[n - 1].value &&
          arr[0].value == arr[n - 1].value + 1 && n > 3) {
        for (int i = 0; i < n; i++)
          if (i == arr[0].id || i == arr[1].id || i == arr[2].id)
            ans[tot][i] = 1;
        tot++;
        break;
      }
      if (arr[0].value <= 1 && arr[1].value <= 1 && arr[2].value <= 1 &&
          arr[3].value == 0 && n > 3) {
        for (int i = 0; i < n; i++)
          if (i == arr[0].id || i == arr[1].id || i == arr[2].id)
            ans[tot][i] = 1;
        tot++;
        break;
      }
      for (int i = 0; i < n; i++)
        if (i == arr[0].id) {
          ans[tot][i] = 1;
          if (arr[0].value) arr[0].value--;
        } else if (i == arr[1].id) {
          ans[tot][i] = 1;
          if (arr[1].value) arr[1].value--;
        }
      tot++;
    }
    printf("%d\n%d\n", arr[n - 1].value, tot);
    for (int i = 0; i < tot; i++) {
      for (int j = 0; j < n; j++) {
        printf("%d", ans[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
