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;
using ll = long long;
const int mod = 1e9 + 7;
int m, a[63], dp[62][62 * 64 / 2][36];
int mat[66][66];
void recover(vector<array<int, 2>> deg, int st = 0) {
  sort(deg.begin() + st, deg.end());
  if (st + 1 == deg.size()) {
    assert(!deg[st][0]);
    return;
  }
  int i = st + 1;
  int cur = deg[st][1];
  while (deg[st][0]) {
    mat[cur][deg[i][1]] = 1;
    deg[st][0]--;
    i++;
  }
  while (i < deg.size()) {
    mat[deg[i][1]][cur] = 1, deg[i][0]--;
    i++;
  }
  recover(deg, st + 1);
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  memset(dp, -1, sizeof dp);
  dp[0][0][0] = 0;
  for (int n = 0; n <= 61; n++) {
    if (n > a[m - 1] && dp[n][n * (n - 1) / 2][m] >= 0) {
      cout << n << endl;
      int deg = n * (n - 1) / 2, i = m;
      vector<array<int, 2>> degs;
      while (n) {
        i = dp[n][deg][i];
        degs.push_back({a[i], --n});
        deg -= a[i];
      }
      reverse(begin(degs), end(degs));
      recover(degs, 0);
      for (int i = 0; i < degs.size(); i++, cout << '\n')
        for (int j = 0; j < degs.size(); j++) cout << mat[i][j];
      exit(0);
    }
    for (int ds = n * (n - 1) / 2; ds < 62 * 62 / 2; ds++) {
      for (int i = 0; i <= m; i++)
        if (dp[n][ds][i] >= 0) {
          if (i == m) continue;
          dp[n + 1][ds + a[i]][i] = i;
          dp[n + 1][ds + a[i]][i + 1] = i;
        }
    }
  }
}