#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 5;
struct node {
  int id, v;
  node() {}
  node(int _id, int _v) : id(_id), v(_v) {}
  bool operator<(const node& str) const { return v < str.v; }
};
int a[maxn], b[maxn], A[10005][maxn];
int n, _min, cnt;
priority_queue<node> q;
bool test(int t) {
  int sum = 0, _max = -1;
  for (int i = 1; i <= n; i++) {
    int w = a[i] - t;
    _max = max(_max, w);
    sum += w;
  }
  sum -= _max;
  return sum >= _max;
}
bool test1() {
  queue<node> qq;
  int num = q.top().v;
  bool ok = 1;
  while (!q.empty()) {
    node tmp = q.top();
    q.pop();
    qq.push(tmp);
    if (tmp.v != num) {
      ok = 0;
      break;
    }
  }
  while (!qq.empty()) {
    q.push(qq.front());
    qq.pop();
  }
  return ok;
}
void adde(node e) {
  if (e.v == 0)
    q.push(e);
  else
    q.push(node(e.id, e.v - 1));
}
void add1(node e) {
  if (e.v > 0) q.push(node(e.id, e.v - 1));
}
int main() {
  cin >> n;
  cnt = 0;
  _min = 105;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    _min = min(_min, a[i]);
  }
  int ans = _min;
  for (; ans > 0; ans--)
    if (test(ans)) break;
  cout << ans << endl;
  if (ans == 0) {
    for (int i = 1; i <= n; i++) q.push(node(i, a[i]));
    while (!test1()) {
      node q1 = q.top();
      q.pop();
      node q2 = q.top();
      q.pop();
      adde(q1);
      adde(q2);
      A[cnt][q1.id] = A[cnt][q2.id] = 1;
      cnt++;
    }
  } else {
    int ssum = 0;
    for (int i = 1; i <= n; i++) {
      int w = a[i] - ans;
      ssum += w;
      q.push(node(i, w));
    }
    while (!test1()) {
      if (ssum & 1) {
        node q1 = q.top();
        q.pop();
        node q2 = q.top();
        q.pop();
        node q3 = q.top();
        q.pop();
        ssum -= 3;
        add1(q1);
        add1(q2);
        add1(q3);
        A[cnt][q1.id] = A[cnt][q2.id] = A[cnt][q3.id] = 1;
        cnt++;
      } else {
        node q1 = q.top();
        q.pop();
        node q2 = q.top();
        q.pop();
        adde(q1);
        adde(q2);
        ssum -= 2;
        A[cnt][q1.id] = A[cnt][q2.id] = 1;
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    for (int j = 1; j <= n; j++) printf("%d", A[i][j]);
    puts("");
  }
  return 0;
}
