#include <bits/stdc++.h>
using namespace std;
inline int getint() {
  int n;
  scanf("%d", &n);
  return n;
}
int main(int, char *[]) {
  int n = getint();
  set<pair<int, int>> s;
  for (int i = 0; i < n; i++) {
    s.insert(make_pair(getint(), n - 1 - i));
  }
  vector<bitset<128>> pr;
  while (s.begin()->first != s.rbegin()->first) {
    pr.emplace_back();
    pr.back().set(s.rbegin()->second);
    pair<int, int> p1 = *s.rbegin();
    if (p1.first) {
      --p1.first;
    }
    s.erase(prev(s.end()));
    if (s.begin()->first == s.rbegin()->first && pr.size() > 1) {
      for (unsigned i = 0; i < pr.size() - 1; i++) {
        if (pr[i].test(p1.second) == false) {
          pr.pop_back();
          pr[i].set(p1.second);
          s.insert(p1);
          goto print;
        }
      }
    }
    pr.back().set(s.rbegin()->second);
    pair<int, int> p2 = *s.rbegin();
    if (p2.first) {
      --p2.first;
    }
    s.erase(prev(s.end()));
    s.insert(p1);
    s.insert(p2);
  }
print:
  printf("%d\n%u\n", s.rbegin()->first, pr.size());
  for (unsigned i = 0; i < pr.size(); i++) {
    printf("%s\n", pr[i].to_string().substr(128 - n).data());
  }
  return 0;
}
