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>
using namespace std;
const int MAXN = 32;
const int MAXV = 101;
const int MAXS = 5555;
int N;
int A[MAXN];
bool dp[MAXN][MAXV][MAXS];
int pi[MAXN][MAXV][MAXS], pk[MAXN][MAXV][MAXS];
void setdp(int i, int j, int k, int ip, int jp, int kp) {
  if (k < MAXS && k >= j * (j - 1) / 2) {
    ;
    dp[i][j][k] = true;
    pi[i][j][k] = ip;
    pk[i][j][k] = kp;
  }
}
vector<int> vdeg;
bool ans[MAXV][MAXV];
set<int> can[MAXV];
void setans(int x, int y) {
  ans[x][y] = true;
  ans[y][x] = false;
  can[x].erase(y);
  can[y].erase(x);
  vdeg[x]--;
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
  }
  sort(A + 1, A + N + 1);
  dp[0][0][0] = true;
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j < MAXV - 1; j++) {
      for (int k = j * (j - 1) / 2; k < MAXS; k++) {
        if (!dp[i][j][k]) {
          continue;
        }
        if (i) {
          setdp(i, j + 1, k + A[i], i, j, k);
        }
        if (i < N) {
          setdp(i + 1, j + 1, k + A[i + 1], i, j, k);
        }
      }
    }
  }
  for (int v = A[N] + 1; v < MAXV; v++) {
    int ci = N, cj = v, ck = v * (v - 1) / 2;
    if (!dp[ci][cj][ck]) {
      continue;
    }
    while (ci) {
      vdeg.push_back(A[ci]);
      ;
      tie(ci, cj, ck) = make_tuple(pi[ci][cj][ck], cj - 1, pk[ci][cj][ck]);
    }
    for (int i = 0; i < v; i++) {
      for (int j = 0; j < v; j++) {
        if (i != j) {
          can[i].insert(j);
        }
      }
    }
    for (int i = 0; i < v; i++) {
      vector<int> verts;
      for (int j = 0; j < v; j++) {
        verts.push_back(j);
      }
      if (verts.empty()) {
        break;
      }
      sort((verts).begin(), (verts).end(),
           [](int x, int y) { return vdeg[x] < vdeg[y]; });
      int x = -1;
      for (int ve : verts) {
        if (vdeg[ve]) {
          x = ve;
          break;
        }
      }
      if (x == -1) {
        break;
      }
      for (int ve : verts) {
        if (can[x].count(ve)) {
          setans(x, ve);
          if (vdeg[x] == 0) {
            break;
          }
        }
      }
      vector<int> vx((can[x]).begin(), (can[x]).end());
      for (int ve : vx) {
        setans(ve, x);
      }
    }
    printf("%d\n", v);
    for (int i = 0; i < v; i++) {
      for (int j = 0; j < v; j++) {
        printf("%d", ans[i][j]);
        if (i != j) {
          assert(ans[i][j] ^ ans[j][i]);
        }
      }
      puts("");
    }
    return 0;
  }
  puts("=(");
}