#include <bits/stdc++.h>
using namespace std;
void Solve(const vector<int>& r, int v) {
  vector<pair<int, int>> a(r.size());
  for (int i = 0; i < r.size(); ++i) {
    a[i] = make_pair(r[i] - v, i);
  }
  sort(a.begin(), a.end(), greater<pair<int, int>>());
  bitset<100> add;
  vector<bitset<100>> res;
  while (a[1].first > 0) {
    add = 0;
    add[a[1].second] = 1;
    add[a[0].second] = 1;
    res.push_back(add);
    --a[0].first;
    --a[1].first;
    sort(a.begin(), a.end(), greater<pair<int, int>>());
  }
  if (v == 0) {
    while (a[0].first > 0) {
      add = 0;
      add[a[1].second] = 1;
      add[a[0].second] = 1;
      res.push_back(add);
      --a[0].first;
    }
  }
  if (a[0].first > 1) return;
  if (a[0].first == 1) {
    if (res.size() == 0 || res.back()[a[0].second]) return;
    res.back()[a[0].second] = 1;
  }
  cout << v << endl;
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); ++i) {
    for (int j = 0; j < r.size(); ++j) {
      cout << res[i][j];
    }
    cout << endl;
  }
  exit(0);
}
int main() {
  int n;
  cin >> n;
  vector<int> r(n);
  for (int i = 0; i < n; ++i) {
    cin >> r[i];
  }
  for (int v = *min_element(r.begin(), r.end()); v >= 0; --v) {
    Solve(r, v);
  }
  return 0;
}
