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;
using ll = long long;
using ld = long double;
const ll MOD = 998244353;
ll binpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
ll modInv(ll a) { return binpow(a, MOD - 2); }
const double PI = acos(-1);
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
int n;
int arr[32];
bool state[1901][62][32];
int main() {
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  state[0][0][0] = true;
  for (int i = (0); i < (n); ++i) {
    for (int j = (1); j < (62); ++j) {
      for (int nn = (0); nn < (1901); ++nn) {
        for (int mm = (0); mm < (62); ++mm) {
          if (state[nn][mm][i]) {
            int nxt1 = nn + arr[i] * j;
            int nxt2 = mm + j;
            if (nxt1 <= 1900 && nxt2 < 62 && nxt1 >= (nxt2 * (nxt2 - 1) / 2)) {
              state[nxt1][nxt2][i + 1] = true;
            }
          }
        }
      }
    }
  }
  int k = -1;
  for (int i = (1); i < (62); ++i) {
    if (state[i * (i - 1) / 2][i][n]) {
      k = i;
      break;
    }
  }
  if (k == -1) {
    cout << "=(\n";
    return 0;
  }
  int currsum = (k * (k - 1)) / 2;
  int currval = k;
  vector<pair<int, int> > all;
  int id = 0;
  for (int i = (n)-1; i >= (0); --i) {
    for (int j = (1); j < (62); ++j) {
      if (j > currval || arr[i] * j > currsum) continue;
      if (state[currsum - arr[i] * j][currval - j][i]) {
        currsum -= arr[i] * j;
        currval -= j;
        for (int b = (0); b < (j); ++b) {
          all.push_back({arr[i], id++});
        }
        break;
      }
    }
  }
  int ans[k][k];
  memset(ans, 0, sizeof(ans));
  sort(all.begin(), all.end());
  int num[k];
  memset(num, 0, sizeof(num));
  while (all.size()) {
    auto val = all[0];
    int cnt = 0;
    for (int i = (1); i < (all.size()); ++i) {
      auto nxt = all[i];
      if (cnt < val.first) {
        ans[val.second][nxt.second] = 1;
      } else {
        ans[nxt.second][val.second] = 1;
        all[i].first--;
      }
      cnt++;
    }
    all.erase(all.begin());
    sort(all.begin(), all.end());
  }
  cout << k << "\n";
  for (int i = (0); i < (k); ++i) {
    for (int j = (0); j < (k); ++j) {
      cout << ans[i][j];
    }
    cout << "\n";
  }
  return 0;
}