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 diagnostic ignored "-Wunused-result"
using namespace std;
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%" PRId64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%" PRId64, x); }
void _W(const double &x) { printf("%.16f\n", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
template <class T>
inline bool chkmax(T &a, const T &b) {
  return b > a ? a = b, true : false;
}
template <class T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, true : false;
}
template <class T, class F = less<T>>
void sort_uniq(vector<T> &v, F f = F()) {
  sort(begin(v), end(v), f);
  v.resize(unique(begin(v), end(v)) - begin(v));
}
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
const int M = 32;
const int N = 80;
const int INF = 1e8;
int m, a[M];
int dp[N][M][N * M];
bool frm[N][M][N * M];
int go(int x, int y, int z) {
  if (z < 0) return INF;
  int &ans = dp[x][y][z];
  if (ans != -1) return ans;
  if (y == m && z == 0) return ans = 0;
  if (y >= m) return INF;
  int v0 = go(x + 1, y, z + a[y] - x);
  int v1 = go(x + 1, y + 1, z + a[y] - x);
  if (v0 <= v1) {
    ans = v0 + 1;
    frm[x][y][z] = 0;
  } else {
    ans = v1 + 1;
    frm[x][y][z] = 1;
  }
  return ans;
}
vector<int> b;
void trace(int x, int y, int z) {
  if (y == m && z == 0) return;
  b.push_back(a[y]);
  if (frm[x][y][z] == 0) {
    trace(x + 1, y, z + a[y] - x);
  } else {
    trace(x + 1, y + 1, z + a[y] - x);
  }
}
bool e[N][N];
int main() {
  memset(dp, -1, sizeof(dp));
  R(m);
  for (int i = 0; i < int(m); i++) R(a[i]);
  sort(a, a + m);
  int n = go(0, 0, 0);
  if (n >= INF) {
    W("=(");
    return 0;
  }
  trace(0, 0, 0);
  ;
  assert(((int)(b).size()) == n);
  W(n);
  vector<pair<int, int>> v;
  for (int i = 0; i < int(n); i++) v.push_back({b[i], i});
  while (!v.empty()) {
    sort(begin(v), end(v));
    int d = v.back().first;
    int w = v.back().second;
    v.pop_back();
    for (int i = 0; i < int(((int)(v).size())); i++) {
      if (i < d)
        e[w][v[i].second] = 1;
      else {
        e[v[i].second][w] = 1;
        v[i].first--;
      }
    }
  }
  for (int i = 0; i < int(n); i++) {
    for (int j = 0; j < int(n); j++) putchar(e[i][j] ? '1' : '0');
    W("");
  }
  return 0;
}