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 MOD = 1000000007;
const int INF = 2e9;
const long long INFLL = 1e18;
const int MAX_N = 100;
const int MAX_K = 2000;
int N, M;
bool b[MAX_N + 10];
bool dp[MAX_N + 10][MAX_K + 10];
int from[MAX_N + 10][MAX_K + 10];
int mx = 0;
vector<int> v;
vector<int> vt;
int d[MAX_N + 10];
int gp[MAX_N + 10][MAX_N + 10];
priority_queue<pair<int, int> > pq;
vector<pair<int, int> > arr;
int main() {
  scanf("%d", &M);
  for (int i = 1; i <= M; i++) {
    int a;
    scanf("%d", &a);
    b[a] = true;
    v.push_back(a);
    mx = max(mx, a);
  }
  if (M == 1 && v.back() == 0) {
    printf("1\n0");
    return 0;
  }
  sort(v.begin(), v.end());
  dp[0][0] = 1;
  int sum = 0;
  int t = 0;
  for (int i = 0; i <= MAX_N; i++) {
    if (!b[i]) {
      sum += i;
      for (int k : v) {
        for (int j = 0; j + k < MAX_K; j++) {
          if (dp[t][j] && j - from[t][j] <= k && !dp[t + 1][j + k]) {
            dp[t + 1][j + k] = true;
            from[t + 1][j + k] = j;
          }
        }
      }
      t++;
      for (int j = 0; j < min(sum, MAX_K); j++) {
        dp[t][j] = false;
      }
    }
    if (i < mx) continue;
    if (dp[t][sum]) {
      N = i;
      i = t;
      while (i != 0) {
        vt.push_back(sum - from[i][sum]);
        sum = from[i--][sum];
      }
      sort(vt.begin(), vt.end());
      int idx = 0;
      for (int j = 0; j <= N; j++) {
        if (b[j]) {
          d[j] = j;
        } else {
          d[j] = vt[idx++];
        }
        arr.push_back({d[j], j});
      }
      while (!arr.empty()) {
        sort(arr.begin(), arr.end());
        pair<int, int> p = arr.back();
        arr.pop_back();
        for (int j = 0; j < p.first; j++) {
          gp[p.second][arr[j].second] = true;
        }
        for (int j = p.first; j < arr.size(); j++) {
          gp[arr[j].second][p.second] = true;
          arr[j].first--;
        }
      }
      printf("%d\n", N + 1);
      for (int j = 0; j <= N; j++) {
        int sum = 0;
        for (int k = 0; k <= N; k++) {
          printf("%d", gp[j][k]);
          sum += gp[j][k];
        }
        printf("\n");
      }
      return 0;
    }
  }
  printf("=(");
  return 0;
}