#include <bits/stdc++.h>
using namespace std;
typedef struct re {
  int n;
  int d[3];
} Re;
Re record[10005];
int main(void) {
  int n;
  scanf("%d", &n);
  int s[n];
  for (int i = 0; i < n; ++i) scanf("%d", &s[i]);
  int test = s[0];
  for (int i = 1; i < n; ++i)
    if (s[i] != test) {
      test = -1;
      break;
    }
  if (test != -1) {
    cout << s[0] << "\n0" << endl;
    return 0;
  }
  int max = 101;
  for (int i = 0; i < n; ++i)
    if (s[i] < max) max = s[i];
  int cnt = 0, flag = 1;
  while (flag) {
    int max1 = -1, max2 = -1;
    for (int i = 0; i < n; ++i) {
      if (s[i] > max1) {
        max2 = max1;
        record[cnt].d[1] = record[cnt].d[0];
        max1 = s[i];
        record[cnt].d[0] = i;
      } else if (s[i] > max2) {
        max2 = s[i];
        record[cnt].d[1] = i;
      }
    }
    for (int i = 0; i < 2; ++i) {
      if (s[record[cnt].d[i]] == 0) continue;
      if (s[record[cnt].d[i]] == max) {
        max--;
        s[record[cnt].d[i]]--;
      } else
        s[record[cnt].d[i]]--;
    }
    int cntmax = 0;
    for (int i = 0; i < n; ++i) {
      if (i == record[cnt].d[0] || i == record[cnt].d[1]) continue;
      if (s[i] == max) cntmax++;
    }
    if (n > 2 && cntmax == n - 3 && s[record[cnt].d[0]] == max &&
        s[record[cnt].d[1]] == max) {
      for (int i = 0; i < n; ++i)
        if (s[i] != max) {
          s[i] = max;
          record[cnt].d[2] = i;
          record[cnt].n = 3;
          break;
        }
    } else
      record[cnt].n = 2;
    flag = 0;
    for (int i = 0; i < n; ++i)
      if (s[i] != max) {
        flag = 1;
        break;
      }
    cnt++;
  }
  cout << max << endl;
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    int tmp[n];
    memset(tmp, 0, sizeof(tmp));
    for (int j = 0; j < record[i].n; j++) tmp[record[i].d[j]] = 1;
    for (int j = 0; j < n; j++) cout << tmp[j];
    putchar('\n');
  }
  return 0;
}
