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;
int n, c, a[32], pre[32][62][4010];
bool dp[32][62][4010], u[95], mat[95][95];
priority_queue<pair<int, int> > priority_queue;
vector<int> v;
vector<pair<int, int> > w;
void create(int first, int second, int z) {
  if (first + second + z == 0) return;
  if (pre[first][second][z] == 1) {
    v.push_back(-a[first - 1]);
    create(first - 1, second, z - a[first - 1]);
  } else {
    v.push_back(-a[first]);
    create(first, second - 1, z - a[first]);
  }
}
int main() {
  dp[0][0][0] = 1;
  cin >> n;
  for (int l = 0; l < n; ++l) {
    cin >> a[l];
  }
  sort(a, a + n);
  for (int l = 0; l < n; ++l) {
    for (int l2 = 0; l2 < 62; ++l2) {
      for (int l3 = 0; l3 < 2800; ++l3) {
        if (!dp[l][l2][l3] || (l + l2) * (l + l2 - 1) / 2 > l3) continue;
        dp[l + 1][l2][l3 + a[l]] = 1;
        pre[l + 1][l2][l3 + a[l]] = 1;
        dp[l][l2 + 1][l3 + a[l]] = 1;
        pre[l][l2 + 1][l3 + a[l]] = 2;
      }
    }
  }
  for (int l = 0; l < 62; ++l) {
    if (dp[n][l][(n + l) * (n + l - 1) / 2]) {
      v.clear();
      w.clear();
      memset(mat, 0, sizeof mat);
      create(n, l, (n + l) * (n + l - 1) / 2);
      sort(v.begin(), v.end());
      for (int l2 = 0; l2 < v.size(); ++l2) {
        v[l2] = -v[l2];
        w.push_back(make_pair(v[l2], l2));
      }
      bool f = 0;
      for (int l2 = 0; l2 < v.size(); ++l2) {
        if (v[l2] < 0) {
          f = 1;
          break;
        }
        memset(u, 0, sizeof u);
        sort(w.begin(), w.end());
        for (int l3 = 0; l3 < w.size(); ++l3) {
          if (w[l3].second == l2) {
            w.erase(w.begin() + l3);
          }
        }
        for (int l3 = 0; l3 < w.size(); ++l3) {
          if (l3 < v[l2])
            mat[l2][w[l3].second] = 1;
          else {
            mat[w[l3].second][l2] = 1;
            w[l3].first--;
            v[w[l3].second]--;
          }
        }
      }
      if (f) continue;
      cout << n + l << endl;
      for (int l2 = 0; l2 < n + l; ++l2) {
        for (int l3 = 0; l3 < n + l; ++l3) {
          cout << mat[l2][l3];
        }
        cout << endl;
      }
      return 0;
    }
  }
  cout << "=(";
  return 0;
}