#include <bits/stdc++.h>
using namespace std;
int N;
int R[101];
int M;
int sum;
int mini;
int maxx;
int now;
bool Round[10005][105] = {false};
int game = 0;
priority_queue<pair<int, int> > pIIq;
pair<int, int> a, b, c;
int main() {
  mini = 1000;
  sum = 0;
  ios_base::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> R[i];
    sum += R[i];
    maxx = max(maxx, R[i]);
    mini = min(mini, R[i]);
  }
  if (maxx == mini) {
    cout << mini << "\n0\n";
    return 0;
  }
  if (N == 2) {
    cout << "0\n";
    cout << maxx << "\n";
    for (int i = 0; i < maxx; i++) {
      cout << "11\n";
    }
    return 0;
  }
  now = sum - mini * N;
  while (maxx - mini > now / 2 && mini) {
    mini--;
    now = sum - mini * N;
  }
  cout << mini << "\n";
  for (int i = 0; i < N; i++) pIIq.push(make_pair(R[i] - mini, i));
  if (now % 2 && mini) {
    a = pIIq.top();
    pIIq.pop();
    b = pIIq.top();
    pIIq.pop();
    c = pIIq.top();
    pIIq.pop();
    Round[game][a.second] = true;
    Round[game][b.second] = 1;
    Round[game][c.second] = 1;
    game++;
    if (a.first) a.first--;
    if (b.first) b.first--;
    if (c.first) c.first--;
    pIIq.push(a);
    pIIq.push(b);
    pIIq.push(c);
  }
  while (pIIq.top().first != 0) {
    a = pIIq.top();
    pIIq.pop();
    b = pIIq.top();
    pIIq.pop();
    Round[game][a.second] = 1;
    Round[game][b.second] = 1;
    game++;
    if (a.first) a.first--;
    if (b.first) b.first--;
    pIIq.push(a);
    pIIq.push(b);
  }
  cout << game << "\n";
  for (int i = 0; i < game; i++) {
    for (int j = 0; j < N; j++) {
      if (Round[i][j])
        cout << "1";
      else
        cout << "0";
    }
    cout << "\n";
  }
  return 0;
}
