#include <bits/stdc++.h>
using namespace std;
int n, w, sum, c[10001][200], o, b[5000];
bool was;
pair<int, int> a[5000];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  w = a[n].first;
  while (true) {
    sum = 0;
    was = false;
    for (int i = 1; i <= n; i++) {
      b[i] = max(a[i].first - w, 0);
      sum += b[i];
    }
    for (int i = 1; i <= n; i++)
      if (w > 0 && b[i] > sum - b[i]) {
        was = true;
        break;
      }
    if (!was) {
      cout << w << endl;
      if (n > 2 && sum % 2 == 1) {
        c[1][a[1].second] = 1;
        c[1][a[2].second] = 1;
        c[1][a[3].second] = 1;
        o = 1;
        a[1].first = max(a[1].first - 1, 0);
        a[2].first = max(a[2].first - 1, 0);
        a[3].first = max(a[3].first - 1, 0);
        sum -= 3;
        sort(a + 1, a + n + 1);
        reverse(a + 1, a + n + 1);
      }
      while (true) {
        if (a[1].first == w) {
          cout << o << endl;
          for (int i = 1; i <= o; i++) {
            for (int j = 1; j <= n; j++) cout << c[i][j];
            cout << endl;
          }
          return 0;
        }
        o++;
        c[o][a[1].second] = 1;
        c[o][a[2].second] = 1;
        a[1].first = max(a[1].first - 1, 0);
        a[2].first = max(a[2].first - 1, 0);
        sort(a + 1, a + n + 1);
        reverse(a + 1, a + n + 1);
      }
    } else
      w--;
  }
  return 0;
}
