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 double pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int digarr[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int alf = 26;
const int dig = 10;
const int two = 2;
const int th = 3;
const long long prost = 239;
const long long btc = 30;
const double eps = 1e-8;
const long long INF = (long long)(1e18 + 239);
const int BIG = (int)(1e9 + 239);
const long long MOD = (int)(1e9 + 7);
const long long MOD2 = (long long)MOD * (long long)MOD;
mt19937_64 rnd(239);
const int M = (int)(2e5 + 239);
const int N = (int)(2e3 + 239);
const int L = 18;
const int T = (1 << 19);
const int B = 500;
const int X = 35;
const int Y = 70;
const int S = X * Y;
int m, a[X];
bool dp[X][Y][S], pr[X][Y][S];
vector<int> d;
void gen(int i, int j, int s) {
  if (j == 0) return;
  d.push_back(a[i]);
  if (pr[i][j][s])
    gen(i - 1, j - 1, s - a[i]);
  else
    gen(i, j - 1, s - a[i]);
}
int mt[Y][Y];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  dp[0][1][a[0]] = true;
  for (int i = 0; i < m; i++)
    for (int j = 1; j < Y; j++)
      for (int s = a[i]; s < S; s++) {
        if (s < (j * (j - 1)) / 2) continue;
        if (dp[i][j - 1][s - a[i]]) {
          dp[i][j][s] = true;
          pr[i][j][s] = false;
        }
        if (i > 0 && dp[i - 1][j - 1][s - a[i]]) {
          dp[i][j][s] = true;
          pr[i][j][s] = true;
        }
      }
  int cn = -1;
  for (int n = 1; n < Y; n++) {
    if (((n * (n - 1)) / 2) >= S) continue;
    if (dp[m - 1][n][(n * (n - 1) / 2)]) {
      cn = n;
      break;
    }
  }
  if (cn == -1) {
    cout << "=(";
    return 0;
  }
  int n = cn;
  gen(m - 1, n, (n * (n - 1)) / 2);
  reverse(d.begin(), d.end());
  vector<pair<int, int>> pr;
  for (int i = 0; i < n; i++) pr.push_back(make_pair(d[i], i));
  memset(mt, -1, sizeof(mt));
  for (int i = 0; i < n; i++) mt[i][i] = 0;
  for (int i = n - 1; i >= 0; i--) {
    sort(pr.begin(), pr.end());
    int p = pr.back().second;
    int d = i - pr.back().first;
    pr.pop_back();
    for (int i = (int)pr.size() - 1; i >= (int)pr.size() - d; i--) {
      mt[pr[i].second][p] = 1;
      mt[p][pr[i].second] = 0;
      pr[i].first--;
    }
    for (int i = (int)pr.size() - d - 1; i >= 0; i--) {
      mt[pr[i].second][p] = 0;
      mt[p][pr[i].second] = 1;
    }
  }
  cout << n << "\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) cout << mt[i][j];
    cout << "\n";
  }
  return 0;
}