#include <bits/stdc++.h>
using namespace std;
vector<int> friends[101];
queue<vector<int> > parties;
int i, n;
void process(int c) {
  vector<int> party;
  for (int j = 0; j < c; ++j) {
    party.push_back(friends[i][0]);
    friends[i - 1].push_back(friends[i][0]);
    friends[i].erase(friends[i].begin());
  }
  parties.push(party);
}
int main() {
  int j, ri;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &ri);
    friends[ri].push_back(i);
  }
  i = 100;
  while (friends[i].size() < n) {
    if (friends[i].size() == 0)
      --i;
    else {
      if (friends[i].size() == 1) {
        j = i - 1;
        while (friends[j].empty()) --j;
        vector<int> party;
        party.push_back(friends[i][0]);
        friends[i - 1].push_back(friends[i][0]);
        friends[i].erase(friends[i].begin());
        party.push_back(friends[j][0]);
        if (j != 0) {
          friends[j - 1].push_back(friends[j][0]);
          friends[j].erase(friends[j].begin());
        }
        parties.push(party);
      } else {
        if (friends[i].size() % 5 == 1) process(4);
        while (friends[i].size() >= 5) process(5);
        if (friends[i].size()) process(friends[i].size());
      }
    }
  }
  printf("%d\n%d\n", i, parties.size());
  vector<int> party;
  int current;
  while (!parties.empty()) {
    party = parties.front();
    sort(party.begin(), party.end());
    j = 0;
    while (!party.empty()) {
      current = party[0];
      while (j++ < current) printf("0");
      printf("1");
      party.erase(party.begin());
    }
    while (j++ < n) printf("0");
    printf("\n");
    parties.pop();
  }
  return 0;
}
