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 MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;
int n, m;
void prework() {}
void read() {}
int a[1000];
int f[80][5000][40];
int deg[MAXN];
int rm[MAXN];
int g[1000][1000];
set<int> st;
int gao(int m) {
  f[1][a[0]][0] = 1;
  int MS = m * (m - 1) / 2;
  for (int i = 1; i < m; i++) {
    for (int j = (i - 1) * i / 2; j <= MS; j++) {
      for (int k = 0; k < n; k++) {
        if (f[i][j][k]) {
          if (j + a[k] <= MS) f[i + 1][j + a[k]][k] = 1;
          if (k != n - 1 && j + a[k + 1] <= MS)
            f[i + 1][j + a[k + 1]][k + 1] = 2;
        }
      }
    }
  }
  if (f[m][MS][n - 1] == 0) return 0;
  printf("%d\n", m);
  for (int i = 1, p = m, q = MS, r = n - 1; i <= m; i++) {
    deg[i] = a[r];
    int pp = p - 1, qq = q - deg[i], rr = r - f[p][q][r] + 1;
    p = pp, q = qq, r = rr;
  }
  reverse(deg + 1, deg + m + 1);
  for (int i = 1; i <= m; i++) rm[i] = m - 1 - deg[i];
  for (int i = 2; i <= m; i++) {
    vector<pair<int, int> > b;
    for (int j = 1; j < i; j++) {
      if (rm[j]) b.push_back(pair<int, int>(rm[j], j));
    }
    sort(b.begin(), b.end());
    for (int j = (int)b.size() - 1; j >= 0 && deg[i]; j--) {
      rm[b[j].second]--;
      deg[i]--;
      g[i][b[j].second] = 1;
    }
  }
  for (int i = 1; i <= m; i++)
    for (int j = i + 1; j <= m; j++) g[i][j] = 1 - g[j][i];
  for (int i = 1; i <= m; i++) {
    int ret = 0;
    for (int j = 1; j <= m; j++) {
      printf("%d", g[i][j]);
      ret += g[i][j];
    }
    assert(st.find(ret) != st.end());
    puts("");
  }
  return 1;
}
void solve(int casi) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    st.insert(a[i]);
  }
  sort(a, a + n);
  for (int m = n; m < 80; m++) {
    if (gao(m)) return;
  }
  puts("=(");
}
void printans() {}
int main() {
  prework();
  int T = 1;
  for (int i = 1; i <= T; i++) {
    read();
    solve(i);
    printans();
  }
  return 0;
}