410249: GYM103993 D Password

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Passwordtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Monocarp has forgotten the password to his mobile phone. The password consists of $$$6$$$ digits from $$$0$$$ to $$$9$$$ (note that it can start with the digit $$$0$$$).

Monocarp remembers that his password had exactly two different digits, and each of these digits appeared exactly three times in the password. Monocarp also remembers some digits which were definitely not used in the password.

You have to calculate the number of different sequences of $$$6$$$ digits that could be the password for Monocarp's mobile phone (i. e. these sequences should meet all of the constraints on Monocarp's password).

Input

The first line contains one integer $$$n$$$ ($$$1 \le n \le 8$$$) — the number of digits for which Monocarp remembers that they were not used in the password.

The second line contains $$$n$$$ different integers $$$a_1, a_2, \dots a_n$$$ ($$$0 \le a_i \le 9$$$) representing the digits that were not used in the password. Note that the digits $$$a_1, a_2, \dots, a_n$$$ are given in ascending order.

Output

Print one integer — the number of different $$$6$$$-digit sequences that meet the constraints.

ExamplesInput
8
0 1 2 4 5 6 8 9
Output
20
Input
1
8
Output
720

加入题单

上一题 下一题 算法标签: