CF850D Tournament Construction

Description

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 $d_1\le d_2\le\dots\le d_n$ if and only if $\sum_{i=1}^kd_i\ge\frac{k(k-1)}2$ for all $1\le k

Input Format

The first line contains a single integer $m(1\le m\le31)$. The next line contains $m$ distinct integers $a_1,a_2,\dots,a_m(0\le a_i\le 30)$ — elements of the set $S$. It is guaranteed that all elements of the set are distinct.

Output Format

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.