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 int MAXN = 31;
int N;
int a[MAXN];
bool bio[MAXN][2 * MAXN][MAXN * MAXN];
vector<int> path, opt;
vector<pair<int, int> > v;
int sol[2 * MAXN][2 * MAXN];
int limit;
void load() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", a + i);
}
void dfs(int pos, int sum) {
  int num = path.size();
  if (pos == N) {
    if (sum == num * (num - 1) / 2 && (opt.empty() || path.size() < opt.size()))
      opt = path;
    return;
  }
  if (num > limit || sum > limit * (limit - 1) / 2) return;
  if (bio[pos][num][sum]) return;
  bio[pos][num][sum] = true;
  sum += a[pos];
  if (sum < num * (num + 1) / 2) return;
  path.push_back(a[pos]);
  dfs(pos, sum);
  dfs(pos + 1, sum);
  path.pop_back();
}
void solve() {
  sort(a, a + N);
  limit = 2 * a[N - 1] + 1;
  dfs(0, 0);
  if (opt.empty()) {
    puts("=(");
    return;
  }
  int nodes = opt.size();
  for (int i = 0; i < nodes; i++) v.push_back({opt[i], i});
  for (int i = 0; i < nodes; i++) {
    for (int j = 0; j < nodes - i - 1; j++)
      if (j < v[i].first)
        sol[v[i].second][v[i + j + 1].second] = 1;
      else {
        sol[v[i + j + 1].second][v[i].second] = 1;
        v[i + j + 1].first--;
      }
    sort(v.begin() + i + 1, v.end());
  }
  printf("%d\n", nodes);
  for (int i = 0; i < nodes; i++, puts(""))
    for (int j = 0; j < nodes; j++) printf("%d", sol[i][j]);
}
int main() {
  load();
  solve();
  return 0;
}