#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-6;
void task();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand(time(0));
  task();
  return 0;
}
void task() {
  int n;
  cin >> n;
  priority_queue<pair<int, int>> q;
  map<int, int> counts;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    counts[a]++;
    q.emplace(a, i);
  }
  vector<string> ans;
  vector<pair<int, int>> now;
  while (counts.size() > 1) {
    now.push_back(q.top());
    q.pop();
    now.push_back(q.top());
    q.pop();
    if (q.size() > 0 && now[0].first == now[1].first &&
        q.top().first == now[0].first && counts[now[0].first] % 2) {
      now.push_back(q.top());
      q.pop();
    }
    string game(n, '0');
    for (auto to : now) {
      q.emplace(max(0, to.first - 1), to.second);
      if (to.first != 0) {
        counts[to.first]--;
        if (counts[to.first] == 0) counts.erase(to.first);
        counts[to.first - 1]++;
      }
      game[to.second] = '1';
    }
    ans.push_back(game);
    now.clear();
  }
  cout << counts.begin()->first << "\n" << ans.size() << "\n";
  for (auto to : ans) cout << to << "\n";
}
