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;
template <class T>
inline void gmin(T &x, const T &y) {
  if (x > y) x = y;
}
template <class T>
inline void gmax(T &x, const T &y) {
  if (x < y) x = y;
}
const int BufferSize = 1 << 16;
char buffer[BufferSize], *Bufferhead, *Buffertail;
bool Terminal;
inline char Getchar() {
  if (Bufferhead == Buffertail) {
    int l = fread(buffer, 1, BufferSize, stdin);
    if (!l) {
      Terminal = 1;
      return 0;
    }
    Buffertail = (Bufferhead = buffer) + l;
  }
  return *Bufferhead++;
}
template <class T>
inline bool read(T &x) {
  x = 0;
  char c = Getchar(), rev = 0;
  while (c < '0' || c > '9') {
    c = Getchar();
    rev |= c == '-';
    if (Terminal) return 0;
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = Getchar();
  if (c == '.') {
    c = Getchar();
    double t = 0.1;
    while (c >= '0' && c <= '9')
      x = x + (c - '0') * t, c = Getchar(), t = t / 10;
  }
  x = rev ? -x : x;
  return 1;
}
template <class T1, class T2>
inline bool read(T1 &x, T2 &y) {
  return read(x) & read(y);
}
template <class T1, class T2, class T3>
inline bool read(T1 &x, T2 &y, T3 &z) {
  return read(x) & read(y) & read(z);
}
template <class T1, class T2, class T3, class T4>
inline bool read(T1 &x, T2 &y, T3 &z, T4 &w) {
  return read(x) & read(y) & read(z) & read(w);
}
inline bool reads(char *x) {
  char c = Getchar();
  while (c < 33 || c > 126) {
    c = Getchar();
    if (Terminal) return 0;
  }
  while (c >= 33 && c <= 126) (*x++) = c, c = Getchar();
  *x = 0;
  return 1;
}
template <class T>
inline void print(T x, const char c = '\n') {
  if (!x) {
    putchar('0');
    putchar(c);
    return;
  }
  if (x < 0) putchar('-'), x = -x;
  int m = 0, a[20];
  while (x) a[m++] = x % 10, x /= 10;
  while (m--) putchar(a[m] + '0');
  putchar(c);
}
const int inf = 0x3f3f3f3f;
const int N = 65, M = 100005, mod = 1e9 + 7;
template <class T, class S>
inline void ch(T &x, const S y) {
  x = (x + y) % mod;
}
inline int exp(int x, int y, const int mod = ::mod) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = (long long)ans * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ans;
}
int n, m, tot, a[N], b[N];
bool dp[N][N][N * N], now[N * N], ans[N][N];
void calc() {
  n = tot;
  printf("%d\n", n);
  reverse(b + 1, b + n + 1);
  for (int i = 1; i < n; i++) {
    int k = n - i - b[i];
    int x = b[n - k + 1], cnt = k;
    for (int j = n; j > i && cnt; j--)
      if (b[j] > x) b[j]--, cnt--, ans[j][i] = 1;
    for (int j = i + 1; j <= n && cnt; j++)
      if (b[j] == x) b[j]--, cnt--, ans[j][i] = 1;
    b[i] = 0;
    for (int j = 1; j <= n; j++) fprintf(stderr, "%d ", b[j]);
    fputs("\n", stderr);
  }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (!ans[j][i]) ans[i][j] = 1;
  for (int i = 1; i <= n; i++, puts(""))
    for (int j = 1; j <= n; j++) putchar(ans[i][j] + '0');
}
inline void solve(int i, int j, int k) {
  if (!i) return;
  for (int x = 1; x <= j; x++)
    if (dp[i - 1][j - x][k - x * a[i]]) {
      for (int p = 1; p <= x; p++) b[++tot] = a[i];
      solve(i - 1, j - x, k - x * a[i]);
      return;
    }
}
int main() {
  read(m);
  for (int i = 1; i <= m; i++) read(a[i]), gmax(n, a[i] + 1);
  sort(a + 1, a + m + 1);
  n <<= 1;
  dp[0][0][0] = 1;
  for (int i = 1; i <= m; i++) {
    memset(now, 0, sizeof(now));
    for (int j = 0; j <= n; j++)
      for (int k = j * (j - 1) / 2; k <= n * (n - 1) / 2; k++) {
        dp[i][j][k] = now[j * a[i] - k];
        now[j * a[i] - k] |= dp[i - 1][j][k];
      }
  }
  n >>= 1;
  for (int i = n; i <= n * 2; i++)
    if (dp[m][i][i * (i - 1) / 2]) {
      solve(m, i, i * (i - 1) / 2);
      calc();
      return 0;
    }
  puts("=(");
  return 0;
}