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