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 input(T &x) {
  register char c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline long long bigmod(long long p, long long e, long long M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
const int N = 65;
int n, m;
int a[50];
vector<int> v;
int g[100][100];
int dp[5000][66][33];
int path[5000][66][33];
int solve(int sum, int taken, int pos) {
  if (sum < taken * (taken - 1) / 2) return 0;
  if (taken > n) return 0;
  if (sum > n * (n - 1) / 2) return 0;
  if (taken == n) {
    if (sum == n * (n - 1) / 2 && pos == m + 1) return 1;
    return 0;
  }
  if (dp[sum][taken][pos] != -1) return dp[sum][taken][pos];
  if (pos > m) return 0;
  int r = solve(sum + a[pos], taken + 1, pos + 1);
  path[sum][taken][pos] = 1;
  if (r == 0) {
    r = solve(sum + a[pos], taken + 1, pos);
    path[sum][taken][pos] = 2;
  }
  return dp[sum][taken][pos] = r;
}
void print(int sum, int taken, int pos) {
  if (taken == n) return;
  v.push_back(a[pos]);
  if (path[sum][taken][pos] == 1)
    print(sum + a[pos], taken + 1, pos + 1);
  else
    print(sum + a[pos], taken + 1, pos);
}
int main() {
  cin >> m;
  int tot = 0;
  for (int i = 1; i <= m; i++) cin >> a[i], tot += a[i];
  sort(a + 1, a + m + 1);
  for (int i = 1; i <= 61; i++) {
    n = i;
    memset(dp, -1, sizeof(dp));
    if (solve(0, 0, 1)) {
      print(0, 0, 1);
      int sum = 0;
      for (int i = 0; i < v.size(); i++) {
        sum += v[i];
        assert(sum >= i * (i + 1) / 2);
      }
      int n = i;
      vector<pair<int, int> > temp;
      for (int i = 0; i < n; i++) temp.push_back({v[i], i});
      bool flag = 1;
      int cnt = 0;
      for (int i = 0; i < n; i++) {
        sort((temp).begin(), (temp).end());
        auto now = *temp.begin();
        temp.erase(temp.begin());
        for (vector<pair<int, int> >::iterator it = temp.begin();
             it != temp.end(); it++) {
          if (now.first) {
            g[now.second][it->second] = 1;
            now.first--;
          } else {
            g[it->second][now.second] = 1;
            it->first--;
          }
          cnt++;
        }
      }
      printf("%d\n", i);
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) printf("%d", g[i][j] > 0 ? 1 : 0);
        printf("\n");
      }
      return 0;
    }
  }
  printf("=(\n");
  return 0;
}