#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> v(n);
  vector<vector<int>> v1;
  for (int i = 0; i < n; ++i) {
    cin >> v[i].first;
    v[i].second = i;
  }
  for (;;) {
    sort(v.begin(), v.end());
    if (v[0].first == v[n - 1].first) {
      break;
    }
    vector<int> v0(n);
    if (v.size() > 3 && v[0].first == v[n - 4].first &&
        v[n - 3].first == v[n - 1].first) {
      v[n - 1].first = max(0, v[n - 1].first - 1);
      v[n - 2].first = max(0, v[n - 2].first - 1);
      v[n - 3].first = max(0, v[n - 3].first - 1);
      v0[v[n - 1].second] = 1;
      v0[v[n - 2].second] = 1;
      v0[v[n - 3].second] = 1;
      v1.push_back(v0);
      continue;
    }
    v[n - 1].first = max(0, v[n - 1].first - 1);
    v[n - 2].first = max(0, v[n - 2].first - 1);
    v0[v[n - 1].second] = 1;
    v0[v[n - 2].second] = 1;
    v1.push_back(v0);
  }
  cout << v[0].first << endl;
  cout << v1.size() << endl;
  for (int i = 0; i < v1.size(); ++i) {
    for (int j = 0; j < n; ++j) {
      cout << v1[i][j];
    }
    cout << endl;
  }
  return 0;
}
