Mr.Young wishes to take a picture of his class.The students will stand in rows with each row no longer than the row behind it and the left ends of the rows aligned.For instance, students could be arranged in rows (from back to front) of and students.
X X X X X
X X X
X X X
X
In addition,Mr.Young wants the students in each row arranged so that heights decrease from left to right.Also,student heights should decrease from the back to the front.Thinking about it,Mr.Young sees that for the 12-student example,there are at least two ways to arrange the students (with as the tallest etc.):
Mr.Young wonders how many different arrangements of the students there might be for a given arrangement of rows.He tries counting by hand starting with rows of and and counts arrangements:
Mr.Young sees that counting by hand is not going to be very effective for any reasonable number of students so he asks you to help out by writing a computer program to determine the number of different arrangements of students for a given set of rows.
The input for each problem instance will consist of two lines.The first line gives the number of rows,,as a decimal integer.The second line contains the lengths of the rows from back to front(05N30$.
输出格式
The output for each problem instance shall be the number of arrangements of the students into the given rows so that the heights decrease along each row from left to right and along each column from back to front as a decimal integer.(Assume all heights are distinct.)The result of each problem instance should be on a separate line.The input data will be chosen so that the result will always fit in an unsigned bit integer.