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>
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
using namespace std;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T, class U>
inline void print(T first, U second) {
  printsp(first);
  println(second);
}
template <class T, class U, class V>
inline void print(T first, U second, V z) {
  printsp(first);
  printsp(second);
  println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
const int N = 77, M = 3333;
int d[N][M][N], t[N][M][N], s[N], n, ans[N][N], Max;
pair<int, int> p[N];
bool cmp(pair<int, int> u, pair<int, int> v) { return u.second < v.second; }
void put(int m) {
  int a = m, b = m * (m - 1) / 2, c = n, cnt = 0;
  println(m);
  while (a) {
    cnt++;
    p[cnt].first = cnt;
    p[cnt].second = s[c];
    int tmp = t[a][b][c];
    a--;
    b -= s[c];
    c -= tmp;
  }
  for (int i = 1; i <= m; i++, cnt--) {
    sort(p + 1, p + cnt + 1, cmp);
    int first = p[cnt].first, second = p[cnt].second;
    for (int j = 1; j < cnt; j++) {
      if (j <= second)
        ans[first][p[j].first] = 1;
      else
        ans[p[j].first][first] = 1, p[j].second--;
    }
  }
  for (int i = 1; i <= m; i++, puts(""))
    for (int j = 1; j <= m; j++) print(ans[i][j]);
  return;
}
bool nam(int m) {
  memset(d, 0, sizeof d);
  d[0][0][0] = 1;
  for (int i = 0; i < m; i++) {
    int st = i * (i - 1) / 2, ed = min(m * (m - 1) / 2, i * (m - 1)) + 1;
    for (int j = st; j < ed; j++)
      for (int k = 0; k <= n; k++)
        if (d[i][j][k]) {
          if (k > 0) {
            d[i + 1][j + s[k]][k] = 1;
            t[i + 1][j + s[k]][k] = 0;
          }
          if (k < n) {
            d[i + 1][j + s[k + 1]][k + 1] = 1;
            t[i + 1][j + s[k + 1]][k + 1] = 1;
          }
        }
  }
  if (!d[m][m * (m - 1) / 2][n]) return true;
  put(m);
  return false;
}
void solve() {
  gn(n);
  for (int i = 1; i <= n; smax(Max, s[i]), i++) gn(s[i]);
  sort(s + 1, s + n + 1);
  int i = Max + 1;
  for (sort(s + 1, s + n + 1); nam(i); i++)
    if (i == 62) {
      puts("=(");
      return;
    }
  exit(0);
}
int main() {
  solve();
  return 0;
}