Problem: Ivan is reading a book about tournaments. He knows that a tournament is an oriented graph with exactly one oriented edge between each pair of vertices. The score of a vertex is the number of edges going outside this vertex. 

Yesterday Ivan learned Landau's criterion: there is tournament with scores d1 ≤ d2 ≤ ... ≤ dn if and only if <image> for all 1 ≤ k < n and <image>.

Now, Ivan wanna solve following problem: given a set of numbers S = {a1, a2, ..., am}, is there a tournament with given set of scores? I.e. is there tournament with sequence of scores d1, d2, ..., dn such that if we remove duplicates in scores, we obtain the required set {a1, a2, ..., am}? 

Find a tournament with minimum possible number of vertices. 

Input

The first line contains a single integer m (1 ≤ m ≤ 31).

The next line contains m distinct integers a1, a2, ..., am (0 ≤ ai ≤ 30) — elements of the set S. It is guaranteed that all elements of the set are distinct.

Output

If there are no such tournaments, print string "=(" (without quotes).

Otherwise, print an integer n — the number of vertices in the tournament.

Then print n lines with n characters — matrix of the tournament. The j-th element in the i-th row should be 1 if the edge between the i-th and the j-th vertices is oriented towards the j-th vertex, and 0 otherwise. The main diagonal should contain only zeros.

Examples

Input

2
1 2


Output

4
0011
1001
0100
0010


Input

2
0 3


Output

6
000111
100011
110001
011001
001101
000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 15;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
bool dp[35][62][2201];
int rev[35][62][2201];
int in[35];
int ans[65][65];
bool tchk[65];
int main() {
  int N, i, j, k, l;
  scanf("%d", &N);
  for (i = 1; i <= N; i++) scanf("%d", &in[i]);
  sort(in + 1, in + N + 1);
  dp[0][0][0] = true;
  for (i = 1; i <= N; i++) {
    for (j = 0; j <= 61; j++) {
      for (k = 0; k <= 2200; k++) {
        if (!dp[i - 1][j][k]) continue;
        for (l = 1;; l++) {
          int t1 = j + l, t2 = k + in[i] * l;
          if (t1 > 61 || t2 > 2200) break;
          if (t2 < t1 * (t1 - 1) / 2) continue;
          dp[i][t1][t2] = true;
          rev[i][t1][t2] = l;
        }
      }
    }
  }
  for (i = 1; i <= 61; i++)
    if (dp[N][i][i * (i - 1) / 2]) break;
  if (i > 61) return !printf("=(\n");
  int v1 = i, v2 = i * (i - 1) / 2;
  vector<int> Vx;
  for (i = N; i >= 1; i--) {
    int t = rev[i][v1][v2];
    for (j = 1; j <= t; j++) Vx.push_back(in[i]);
    v1 -= t, v2 -= in[i] * t;
  }
  N = Vx.size();
  printf("%d\n", N);
  for (i = 0; i < N; i++) {
    vector<int> Vu;
    for (j = 0; j < N; j++)
      if (!tchk[j]) Vu.push_back(j);
    sort((Vu).begin(), (Vu).end(), [&](int a, int b) { return Vx[a] > Vx[b]; });
    for (j = 1; j <= (int)Vu.size() - 1 - Vx[Vu[0]]; j++) {
      ans[Vu[j]][Vu[0]] = 1;
      Vx[Vu[j]]--;
    }
    for (; j < Vu.size(); j++) ans[Vu[0]][Vu[j]] = 1;
    tchk[Vu[0]] = true;
  }
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) printf("%d", ans[i][j]);
    printf("\n");
  }
  return 0;
}