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;
bool dp[35][65][2005];
bool last[35][65][2005];
int a[35];
int b[65];
int res[65][65];
void dfs(int n, int k, int j) {
  if (k == 0) return;
  b[k - 1] = a[n - 1];
  if (last[n][k][j] == 1) {
    dfs(n - 1, k - 1, j - a[n - 1]);
  } else {
    dfs(n, k - 1, j - a[n - 1]);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  dp[0][0][0] = true;
  for (i = 1; i <= n; i++) {
    int j;
    int k;
    for (k = i; k <= 61; k++) {
      for (j = k * (k - 1) / 2; j <= 60 * 61 / 2; j++) {
        if (j < a[i - 1]) continue;
        if (dp[i - 1][k - 1][j - a[i - 1]]) {
          dp[i][k][j] = true;
          last[i][k][j] = 1;
        }
        if (dp[i][k - 1][j - a[i - 1]]) {
          dp[i][k][j] = true;
          last[i][k][j] = 0;
        }
      }
    }
  }
  int ans;
  for (ans = 0;;) {
    if (ans >= 61) {
      puts("=(");
      return 0;
    }
    ans++;
    if (dp[n][ans][ans * (ans - 1) / 2]) break;
  }
  printf("%d\n", ans);
  dfs(n, ans, ans * (ans - 1) / 2);
  memset(res, -1, sizeof(res));
  for (i = 0; i < ans; i++) {
    res[i][i] = 0;
  }
  for (i = 0; i < ans; i++) {
    int j;
    int mins = ans + 1, min_id = -1;
    for (j = 0; j < ans; j++) {
      if (b[j] < mins) {
        mins = b[j];
        min_id = j;
      }
    }
    j = min_id;
    int k;
    for (k = 0; k < b[j]; k++) {
      int l;
      int min2 = ans + 1, min2_id = -1;
      for (l = 0; l < ans; l++) {
        if (res[j][l] != -1) continue;
        if (j == l) continue;
        if (b[l] < min2) {
          min2 = b[l];
          min2_id = l;
        }
      }
      res[j][min2_id] = 1;
      res[min2_id][j] = 0;
    }
    for (k = 0; k < ans; k++) {
      if (res[j][k] != -1) continue;
      res[j][k] = 0;
      res[k][j] = 1;
      b[k]--;
    }
    b[j] = ans + 1;
  }
  for (i = 0; i < ans; i++) {
    int j;
    for (j = 0; j < ans; j++) {
      printf("%d", res[i][j]);
    }
    printf("\n");
  }
  return 0;
}