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>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native")
using namespace std;
namespace output {
void __(short x) { cout << x; }
void __(unsigned x) { cout << x; }
void __(int x) { cout << x; }
void __(long long x) { cout << x; }
void __(unsigned long long x) { cout << x; }
void __(double x) { cout << x; }
void __(long double x) { cout << x; }
void __(char x) { cout << x; }
void __(const char* x) { cout << x; }
void __(const string& x) { cout << x; }
void __(bool x) { cout << (x ? "true" : "false"); }
template <class S, class T>
void __(const pair<S, T>& x) {
  __(1 ? "(" : ""), __(x.first), __(1 ? ", " : " "), __(x.second),
      __(1 ? ")" : "");
}
template <class T>
void __(const vector<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class T>
void __(const set<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class T>
void __(const multiset<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class S, class T>
void __(const map<S, T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
void pr() { cout << "\n"; }
template <class S, class... T>
void pr(const S& a, const T&... b) {
  __(a);
  if (sizeof...(b)) __(' ');
  pr(b...);
}
}  // namespace output
using namespace output;
const int MN = 35, MX = 80;
int n, i, j, k, arr[MN], ok[MN][MX][MX * MX], grid[MX][MX];
int main() {
  for (scanf("%d", &n), i = 1; i <= n; i++) scanf("%d", &arr[i]);
  sort(arr + 1, arr + n + 1);
  ok[0][0][0] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j < MX; j++) {
      for (k = arr[i]; k < MX * MX; k++) {
        if (k >= j * (j - 1) / 2 &&
            (ok[i][j - 1][k - arr[i]] || ok[i - 1][j - 1][k - arr[i]]))
          ok[i][j][k] = 1;
      }
    }
  }
  vector<pair<int, int> > ans;
  int x, y, z, sna = 1 << 30;
  for (i = 1; i < MX; i++) {
    for (j = 1; j < MX * MX; j++) {
      if (ok[n][i][j] && i * (i - 1) / 2 == j) {
        sna = i, x = n, y = i, z = j;
        break;
      }
    }
    if (sna != (1 << 30)) break;
  }
  if (n == 1 && arr[1] == 0) {
    printf("1\n0\n");
    return 0;
  }
  if (sna == (1 << 30))
    printf("=(\n");
  else {
    int nxt = 0;
    while (x >= 1) {
      ans.push_back({arr[x], nxt++});
      y--, z -= arr[x];
      if (!ok[x][y][z]) x--;
    }
    printf("%d\n", ans.size());
    int sz = ans.size();
    sort(ans.begin(), ans.end(),
         [](pair<int, int> i, pair<int, int> j) { return i.first < j.first; });
    while (ans.size()) {
      pair<int, int> cur = ans.back();
      ans.pop_back();
      for (i = 0; i < ans.size(); i++) {
        grid[cur.second][ans[i].second] = 1;
        if (i >= cur.first) {
          grid[cur.second][ans[i].second] ^= 1;
          grid[ans[i].second][cur.second] ^= 1;
          ans[i].first--;
        }
      }
      sort(ans.begin(), ans.end(), [](pair<int, int> i, pair<int, int> j) {
        return i.first < j.first;
      });
    }
    for (i = 0; i < sz; i++) {
      for (j = 0; j < sz; j++) {
        printf("%d", grid[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}