Bob loves snakes! In fact, he was delighted to learn that 2025 is the Year of the Snake! The Lunar Calendar follows a 12 year cycle with one of twelve animals representing each year. 2001, 2013, and now, 2025, are Years of the Snake. The next Year of the Snake will be 2037. Bob has a set of numbers, and would like to rearrange them into a Year of the Snake. Help Bob count how many different Years of the Snake he can form by rearranging his set of numbers. Leading zeroes are not allowed.
The first line contains the integer $$$n$$$ $$$(1 \leq n \leq 6)$$$ — the size of Bob's set of numbers.
The next line will contain $$$n$$$ space separated digits $$$d_i$$$. $$$(0 \leq d_i \leq 9)$$$
Output a single integer, the number of different Years of the Snake that Bob can form by rearranging his set of integers.
23 3
1
42 0 2 5
2
31 2 3
2
In the first test case, the only Year of the Snake that can be formed is 33. In the second test case, 2025 and 2205 are both valid Years of the Snake.