#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3F3F3F3F;
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-8;
int cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
string doit(int n, const vector<int> &x) {
  string ans;
  for (int i = 0; i < n; i++) {
    bool part = false;
    for (int j : x)
      if (i == j) part = true;
    if (part)
      ans += '1';
    else
      ans += '0';
  }
  return ans;
}
int main() {
  int N;
  scanf("%d", &N);
  vector<int> V(N);
  for (int &x : V) scanf("%d", &x);
  int target = *min_element((V).begin(), (V).end());
  vector<string> ans;
  priority_queue<pair<int, int>> heap;
  int g = 0;
  for (__decltype(0) i = (0); i < (N); ++i) {
    heap.push({V[i], i});
    g += V[i] > target;
  }
  while (!heap.empty()) {
    auto x = heap.top();
    heap.pop();
    if (x.first == target) break;
    auto y = heap.top();
    heap.pop();
    if (y.first == target && target > 0) {
      target--;
      g = N;
    }
    if (g == 3 && x.first == target + 1) {
      auto z = heap.top();
      heap.pop();
      ans.push_back(doit(N, {x.second, y.second, z.second}));
      V[z.second] = max(V[z.second] - 1, 0);
      heap.push({V[z.second], z.second});
      if (V[z.second] == target) g--;
    } else
      ans.push_back(doit(N, {x.second, y.second}));
    V[x.second] = max(V[x.second] - 1, 0);
    V[y.second] = max(V[y.second] - 1, 0);
    if (V[x.second] == target) g--;
    if (V[y.second] == target) g--;
    heap.push({V[x.second], x.second});
    heap.push({V[y.second], y.second});
  }
  printf("%d\n%d\n", target, ans.size());
  for (string &s : ans) printf("%s\n", s.c_str());
  return 0;
}
