#include <bits/stdc++.h>
char rounds[10000][100 + 1] = {0};
int round_num = 0;
typedef struct {
  int position;
  int rating;
} friend_t, *friend_ptr_t;
int cmp_friends(const void* a, const void* b) {
  return ((friend_ptr_t)b)->rating - ((friend_ptr_t)a)->rating;
}
int main() {
  int friends_num;
  fscanf(stdin, "%d\n", &friends_num);
  friend_t friends[friends_num];
  for (int k = 0; k < friends_num; ++k) {
    fscanf(stdin, "%d", &friends[k].rating);
    friends[k].position = k;
  }
  bool equal;
  do {
    qsort(friends, friends_num, sizeof(friend_t), &cmp_friends);
    int team = 1;
    equal = true;
    do {
      if (friends[0].rating != friends[team].rating) {
        equal = false;
      } else {
        ++team;
      }
    } while ((team < friends_num) && (equal));
    if (!equal) {
      if (team == 1) {
        team = 2;
      }
      do {
        int block;
        if (team == 6) {
          block = 4;
        } else {
          block = (team < 5) ? team : 5;
        }
        for (int k = 0; k < friends_num; ++k) {
          rounds[round_num][friends[k].position] = (k < block) ? '1' : '0';
          if ((k < block) && (friends[k].rating > 0)) {
            --friends[k].rating;
          }
        }
        qsort(friends, friends_num, sizeof(friend_t), &cmp_friends);
        team -= block;
        ++round_num;
      } while (team > 0);
    }
  } while (!equal);
  printf("%d\n%d\n", friends[0].rating, round_num);
  for (int k = 0; k < round_num; ++k) {
    printf("%s\n", rounds[k]);
  }
}
