#include <bits/stdc++.h>
using namespace std;
int n, m, x, t, q, k, y, f, z;
pair<int, int> a[105];
vector<int> v[10005];
bool check() {
  for (int i = 1; i < n; ++i)
    if (a[i].first != a[i - 1].first) return 0;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i].first, a[i].second = i;
  while (!check()) {
    sort(a, a + n);
    if (n > 2 && a[n - 3].first == a[0].first + 1 &&
        a[n - 3].first == a[n - 4].first + 1 &&
        a[n - 3].first == a[n - 1].first)
      a[n - 3].first--, v[k].push_back(a[n - 3].second);
    v[k].push_back(a[n - 1].second), v[k++].push_back(a[n - 2].second);
    a[n - 1].first = max(y, a[n - 1].first - 1),
          a[n - 2].first = max(y, a[n - 2].first - 1);
  }
  cout << a[0].first << endl << k << endl;
  for (int i = 0; i < k; ++i) {
    sort(v[i].begin(), v[i].end());
    v[i].push_back(n + 1);
    x = 0;
    for (int j = 0; j < n; ++j)
      if (v[i][x] == j)
        cout << 1, ++x;
      else
        cout << 0;
    cout << endl;
  }
}
