#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const double pi = acos(-1.0);
const int maxn = 300005;
int ans[10005][105];
struct app {
  int i, n;
};
app a[500];
int cmp(app a, app b) { return a.n > b.n; }
int n, i, j, k, l, m, t, x, y, z;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].n;
    a[i].i = i;
  }
  sort(a + 1, a + n + 1, cmp);
  while (a[1].n != a[n].n) {
    t++;
    if (a[1].n == a[2].n && a[2].n == a[3].n && a[3].n != a[4].n) {
      a[1].n--;
      a[2].n--;
      a[3].n--;
      ans[t][a[1].i] = 1;
      ans[t][a[2].i] = 1;
      ans[t][a[3].i] = 1;
    } else {
      a[1].n--;
      if (a[2].n != 0) a[2].n--;
      ans[t][a[1].i] = 1;
      ans[t][a[2].i] = 1;
    }
    sort(a + 1, a + n + 1, cmp);
  }
  cout << a[1].n << endl;
  cout << t << endl;
  for (int i = 1; i <= t; i++) {
    for (int j = 1; j <= n; j++) cout << ans[i][j];
    cout << endl;
  }
}
