#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> a[100];
vector<string> w;
string cle = "";
bool cmp_val(pair<int, int> a, pair<int, int> b) { return a.second > b.second; }
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i].second, a[i].first = i, cle = cle + "0";
  sort(a, a + n, cmp_val);
  while (a[0].second != a[n - 1].second) {
    string work = cle;
    bool k = 0;
    if (n > 2)
      if (a[3].second == a[n - 1].second) {
        if (a[2].second > a[n - 1].second && a[0].second == a[2].second) {
          a[0].second--;
          a[1].second--;
          a[2].second--;
          work[a[0].first] = '1';
          work[a[1].first] = '1';
          work[a[2].first] = '1';
          w.push_back(work);
          sort(a, a + n, cmp_val);
          k = 1;
        }
      }
    if (k == 0) {
      a[0].second = max(a[0].second - 1, 0);
      a[1].second = max(a[1].second - 1, 0);
      work[a[0].first] = '1';
      work[a[1].first] = '1';
      w.push_back(work);
      sort(a, a + n, cmp_val);
    }
  }
  cout << a[0].second << endl << w.size() << endl;
  for (int i = 0; i < w.size(); i++) cout << w[i] << endl;
  return 0;
}
