#include <bits/stdc++.h>
using namespace std;
const long long int INF = (long long int)1e9 + 10;
const long long int INFLL = (long long int)1e18 + 10;
const long double EPS = 1e-8;
long long int MOD = 1e9 + 7;
template <class T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <class T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
template <class T>
inline T sq(T a) {
  return a * a;
}
long long int in() {
  long long int x;
  scanf("%lld", &x);
  return x;
}
int n;
vector<pair<int, int> > v;
vector<string> ans;
int main() {
  n = in();
  for (long long int i = (0); i < (long long int)(n); i++) {
    v.emplace_back(in(), i);
  }
  while (1) {
    sort((v).begin(), (v).end());
    if (v[0].first == v[n - 1].first) {
      break;
    }
    string cur(n, '0');
    if (n >= 4 and v[n - 1].first == v[n - 2].first and
        v[n - 2].first == v[n - 3].first and
        v[n - 3].first != v[n - 4].first and v[n - 1].first == v[0].first + 1) {
      for (long long int i = (0); i < (long long int)(3); i++) {
        v[n - 1 - i].first = max(0, v[n - 1 - i].first - 1);
        cur[v[n - 1 - i].second] = '1';
      }
    } else {
      for (long long int i = (0); i < (long long int)(2); i++) {
        v[n - 1 - i].first = max(0, v[n - 1 - i].first - 1);
        cur[v[n - 1 - i].second] = '1';
      }
    }
    ans.emplace_back(cur);
  }
  sort((v).begin(), (v).end());
  assert(v[0].first == v[n - 1].first);
  printf("%d\n", v[0].first);
  printf("%lld\n", ((long long int)(ans).size()));
  for (auto &w : ans) {
    printf("%s\n", w.c_str());
  }
  return 0;
}
