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 chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int max0 = 70;
const int max1 = 500;
const int maxn = 50;
int n;
int a[maxn + 5];
int pre[maxn + 5][max0 + 5][max1 + 5];
int main() {
  scanf("%d", &n);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) scanf("%d", a + i);
  sort(a, a + n);
  memset(pre, -1, sizeof pre);
  pre[0][0][0] = 0;
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    for (int j = (0), j_end_ = (max0); j < j_end_; ++j)
      for (int k = (0), k_end_ = (max1); k < k_end_; ++k)
        if (~pre[i][j][k]) {
          if (k + a[i] - j >= 0)
            pre[i][j + 1][k + a[i] - j] = i,
                                     pre[i + 1][j + 1][k + a[i] - j] = i;
        }
  for (int i = (0), i_end_ = (max0); i < i_end_; ++i)
    if (~pre[n][i][0]) {
      int p = n, u = i, v = 0;
      vector<int> ret;
      while (u) {
        p = pre[p][u][v];
        ret.push_back(a[p]);
        --u;
        v += u - a[p];
      }
      reverse((ret).begin(), (ret).end());
      printf("%d\n", (int((ret).size())));
      static bool f[max0 + 5][max1 + 5];
      memset(f, 0, sizeof f);
      for (int j = (0), j_end_ = ((int((ret).size()))); j < j_end_; ++j) {
        static int pos[max0 + 5];
        int posn = 0;
        for (int k = (j + 1), k_end_ = ((int((ret).size()))); k < k_end_; ++k)
          pos[posn++] = k;
        sort(pos, pos + posn,
             [&](int first, int second) { return ret[first] < ret[second]; });
        for (int k = (0), k_end_ = (posn); k < k_end_; ++k)
          if (ret[j]) {
            --ret[j];
            f[j][pos[k]] = 1;
          } else
            f[pos[k]][j] = 1, --ret[pos[k]];
      }
      for (int j = (0), j_end_ = ((int((ret).size()))); j < j_end_; ++j) {
        for (int k = (0), k_end_ = ((int((ret).size()))); k < k_end_; ++k)
          printf("%d", f[j][k]);
        printf("\n");
      }
      return 0;
    }
  puts("=(");
  return 0;
}