DZY has a $n \times n$ square matrix which is used to Orz JRY. Every morning,
DZY always finds $n^2$ people with distinct height, and they form a square matrix. Let person $i$ denote the $i$-th shortest person.
When they start to Orz JRY, JRY smiles and starts waving to them. JRY has a requirement. If he looks straight at the $i$-th column, he can see exactly $a_i$ people. If the person $i$ stands in front of the person $j$ and $i>j$, person $j$ is blocked.
JRY wants to know how many different matrices they can form, so he asked DZY to tell him the answer.
Now, DZY is asking you to work out the result.
![](../../data/images/C573-1004-1.jpg)