#include <bits/stdc++.h>
using namespace std;
struct node {
  int r, id;
  friend bool operator<(const node& a, const node& b) { return a.r > b.r; }
};
multiset<node> s;
vector<string> res;
int main() {
  int n, r;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &r), s.insert({r, i});
  while (s.begin()->r != s.rbegin()->r) {
    vector<node> tmp;
    string ans;
    for (int i = 0; i < n; i++) ans += '0';
    int cnt = 2;
    if (s.count(*s.begin()) == 3) cnt = 3;
    for (int i = 0; i < cnt; i++) {
      node now = *s.begin();
      s.erase(s.begin());
      ans[now.id - 1] = '1';
      if (now.r > 0) now.r--;
      tmp.push_back(now);
    }
    for (int i = 0; i < cnt; i++) s.insert(tmp[i]);
    res.push_back(ans);
  }
  printf("%d\n%d\n", s.begin()->r, res.size());
  for (int i = 0; i < res.size(); i++) cout << res[i] << endl;
  return 0;
}
