#include <bits/stdc++.h>
using namespace std;
const int maxn = 128;
pair<int, int> a[maxn];
int G[maxn * maxn][maxn];
int n, x;
void solve() {
  int minv = maxn;
  memset(G, 0, sizeof G);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[i] = pair<int, int>(x, i);
  }
  int cnt = 0;
  while (1) {
    sort(a + 1, a + n + 1);
    if (a[1].first == a[n].first) break;
    int m = 0;
    ++cnt;
    for (int i = 1; i <= n; i++)
      if (a[i].first > a[1].first) ++m;
    if (m > 1 && m <= 5 && a[n].first - 1 == a[1].first) {
      for (int i = n - m + 1; i <= n; ++i) {
        a[i].first--;
        G[cnt][a[i].second] = 1;
      }
      break;
    } else {
      if (a[n].first) a[n].first--;
      if (a[n - 1].first) a[n - 1].first--;
      G[cnt][a[n].second] = G[cnt][a[n - 1].second] = 1;
    }
  }
  printf("%d\n", a[1].first);
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; ++i) {
    for (int j = 1; j <= n; ++j) printf("%d", G[i][j]);
    puts("");
  }
}
int main() {
  while (~scanf("%d", &n)) {
    solve();
  }
  return 0;
}
