#include <bits/stdc++.h>
using namespace std;
const int MAX = 100001;
const int INF = 1000000001;
struct node {
  int val, ind;
  node() {
    val = -1;
    ind = -1;
  }
} nodes[101];
int n, oper = 0;
int ans[10001][101] = {0};
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> nodes[i].val;
    nodes[i].ind = i - 1;
  }
  while (true) {
    sort(nodes + 1, nodes + 1 + n,
         [](node& x, node& y) { return x.val < y.val; });
    if (nodes[1].val != nodes[n].val) {
      int a, b, c, d;
      a = n;
      b = n - 1;
      c = n - 2;
      d = n - 3;
      if (n >= 3 && nodes[a].val == nodes[b].val &&
          nodes[b].val == nodes[c].val && nodes[c].val != nodes[d].val) {
        ans[oper][nodes[a].ind] = 1;
        ans[oper][nodes[b].ind] = 1;
        ans[oper][nodes[c].ind] = 1;
        nodes[a].val = max(nodes[a].val - 1, 0);
        nodes[b].val = max(nodes[b].val - 1, 0);
        nodes[c].val = max(nodes[c].val - 1, 0);
      } else {
        ans[oper][nodes[a].ind] = 1;
        ans[oper][nodes[b].ind] = 1;
        nodes[a].val = max(nodes[a].val - 1, 0);
        nodes[b].val = max(nodes[b].val - 1, 0);
      }
      oper++;
    } else
      break;
  }
  cout << nodes[n].val << endl;
  cout << oper << endl;
  for (int i = 0; i < oper; i++) {
    for (int j = 0; j < n; j++) cout << ans[i][j];
    cout << endl;
  }
  return 0;
}
