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;
template <typename T>
inline bool chkmax(T& x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T& x) {
  char c;
  int sign = 1;
  x = 0;
  do {
    c = getchar();
    if (c == '-') sign = -1;
  } while (!isdigit(c));
  do {
    x = x * 10 + c - '0';
    c = getchar();
  } while (isdigit(c));
  x *= sign;
}
inline void init(string name) {
  string in = name + ".in", out = name + ".out";
  freopen(in.c_str(), "r", stdin);
  freopen(out.c_str(), "w", stdout);
}
const int N = 62;
int m, mx, a[N];
bool f[N][2 * N][N * N << 1];
bool g[N][2 * N][N * N << 1];
int cnt, mp[2 * N][2 * N];
struct DATA {
  int w, id;
} w[N * 2];
inline bool cmp(DATA a, DATA b) { return a.w < b.w; }
bool vis[N << 1];
inline void solve(int x) {
  printf("%d\n", x);
  int z = x * (x - 1) / 2;
  while (x) {
    w[++cnt].w = a[m];
    w[cnt].id = cnt;
    g[m][x][z] ? z -= a[m] : z -= a[m--];
    --x;
  }
  for (register int i = 2; i <= cnt; ++i) {
    sort(w + 1, w + 1 + cnt, cmp);
    int x = 1;
    while (vis[w[x].id] && x < cnt) ++x;
    for (register int j = 1; j <= cnt; ++j)
      if (!mp[w[x].id][w[j].id] && !mp[w[j].id][w[x].id] && x != j)
        w[x].w ? (mp[w[x].id][w[j].id] = 1, w[x].w--)
               : (mp[w[j].id][w[x].id] = 1, w[j].w--);
    vis[w[x].id] = 1;
  }
  for (register int i = 1; i <= cnt; ++i) {
    for (register int j = 1; j <= cnt; ++j) printf("%d", mp[i][j]);
    puts("");
  }
}
int main() {
  read(m);
  for (register int i = 1; i <= m; ++i) read(a[i]), chkmax(mx, a[i]);
  sort(a + 1, a + 1 + m);
  f[0][0][0] = 1;
  int z = 121 * 120 / 2;
  for (register int i = 1; i <= m; ++i)
    for (register int j = 1; j <= 121; ++j)
      for (register int k = (j - 1) * (j - 2) / 2 + a[i]; k <= 60 * j + a[i];
           ++k)
        if (f[i - 1][j - 1][k - a[i]])
          f[i][j][k] = 1;
        else if (f[i][j - 1][k - a[i]])
          f[i][j][k] = 1, g[i][j][k] = 1;
  for (register int i = m; i <= 121; ++i)
    if (f[m][i][i * (i - 1) / 2]) return solve(i), 0;
  puts("No solution");
  return 0;
}