#include <bits/stdc++.h>
using namespace std;
mt19937 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  multiset<pair<int, int> > a, b;
  for (int i = 0, j; i < n; i++) {
    cin >> j;
    a.insert({j, i});
    b.insert({j, i});
  }
  vector<vector<int> > ans1, ans2;
  while (a.begin()->first != prev(a.end())->first) {
    pair<int, int> x = *prev(a.end());
    a.erase(prev(a.end()));
    pair<int, int> y = *prev(a.end());
    a.erase(prev(a.end()));
    if (a.size() > 0) {
      if (prev(a.end())->first == x.first) {
        pair<int, int> z = *prev(a.end());
        a.erase(prev(a.end()));
        if (a.size() == 0) {
          ans1.push_back({x.second, y.second, z.second});
          x.first = max(0, x.first - 1), y.first = max(0, y.first - 1),
          z.first = max(0, z.first - 1);
          a.insert(x);
          a.insert(y);
          a.insert(z);
          continue;
        } else if (prev(a.end())->first != z.first) {
          ans1.push_back({x.second, y.second, z.second});
          x.first = max(0, x.first - 1), y.first = max(0, y.first - 1),
          z.first = max(0, z.first - 1);
          a.insert(x);
          a.insert(y);
          a.insert(z);
          continue;
        }
        a.insert(z);
      }
    }
    ans1.push_back({x.second, y.second});
    x.first = max(0, x.first - 1), y.first = max(0, y.first - 1);
    a.insert(x);
    a.insert(y);
  }
  while (b.begin()->first != prev(b.end())->first) {
    pair<int, int> x = *prev(b.end());
    b.erase(prev(b.end()));
    pair<int, int> y = *prev(b.end());
    b.erase(prev(b.end()));
    ans2.push_back({x.second, y.second});
    x.first = max(0, x.first - 1), y.first = max(0, y.first - 1);
    b.insert(x);
    b.insert(y);
  }
  if (a.begin()->first > b.begin()->first) {
    cout << a.begin()->first << endl;
    cout << ans1.size() << endl;
    for (auto &x : ans1) {
      for (int i = 0; i < n; i++)
        cout << (find(x.begin(), x.end(), i) != x.end() ? 1 : 0);
      cout << endl;
    }
  } else {
    cout << b.begin()->first << endl;
    cout << ans2.size() << endl;
    for (auto &x : ans2) {
      for (int i = 0; i < n; i++)
        cout << (find(x.begin(), x.end(), i) != x.end() ? 1 : 0);
      cout << endl;
    }
  }
}
