#include <bits/stdc++.h>
using namespace std;
int n, a[10000], res = 1, ans[10000][1000];
pair<int, int> b[10000];
bool done() {
  for (int i = 1; i <= n; i++)
    if (a[i] != a[1]) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  while (!done()) {
    for (int i = 1; i <= n; i++) b[i] = make_pair(a[i], i);
    sort(b + 1, b + 1 + n);
    reverse(b + 1, b + 1 + n);
    int i = 2;
    while (i <= n && (i < 3 || b[i].first == b[1].first)) i++;
    i--;
    if (i % 2 == 0) {
      for (int j = 1; j < i; j += 2) {
        ans[res][b[j].second] = 1;
        ans[res][b[j + 1].second] = 1;
        res++;
      }
    } else {
      ans[res][b[1].second] = 1;
      ans[res][b[2].second] = 1;
      ans[res][b[3].second] = 1;
      res++;
      for (int j = 4; j < i; j += 2) {
        ans[res][b[j].second] = 1;
        ans[res][b[j + 1].second] = 1;
        res++;
      }
    }
    for (int j = 1; j <= i; j++) {
      int id = b[j].second;
      a[id] = max(a[id] - 1, 0);
    }
  }
  res--;
  cout << a[1] << endl;
  cout << res << endl;
  for (int i = 1; i <= res; i++) {
    for (int j = 1; j <= n; j++) cout << ans[i][j];
    cout << endl;
  }
}
