AT_past202309_g N個の三角形

Description

There are $ 3N $ sticks. The length of the $ i $ -th stick is $ A_i $ . How many ways are there to group them into triplets so that they form $ N $ triangles? Here, two ways to form $ N $ triangles are distinguished if and only if there is a triplet forming a triangle in one way that does not form a triangle in the other way. For more details, see the description of Sample Input $ 1 $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ A_1 $ $ \ldots $ $ A_{3N} $

Output Format

Print the answer.

Explanation/Hint

### Sample Explanation 1 We denote by $ (i,j,k) $ the triangle formed by the following three sticks: $ i $ -th, $ j $ -th, and $ k $ -th. There are seven ways as follows. Note that equal-length sticks are distinguished. - $ (1,2,3),(4,5,6) $ - $ (1,2,4),(3,5,6) $ - $ (1,2,5),(3,4,6) $ - $ (1,3,4),(2,5,6) $ - $ (1,3,5),(2,4,6) $ - $ (2,3,4),(1,5,6) $ - $ (2,3,5),(1,4,6) $ On the other hand, for instance, the $ 1 $ -st, $ 2 $ -nd, and $ 6 $ -th sticks do not form a triangle. ### Constraints - $ 1 \leq N \leq 4 $ - $ 1 \leq A_i \leq 100 $ - All input values are integers.