cho.sh
Notes
Loading...

Hexagons

Time limit

2s

Memory limit

128 MB

Problem

You are given N sticks with integer lengths. Some sticks may have the same length. Choose exactly six sticks and connect them in some order to make a hexagon. You may not join several sticks into one side, and you may not cut a stick into a shorter side. All six interior angles of the resulting hexagon must be equal.

Count how many different hexagons can be made from the given sticks. Hexagons that become the same by rotation or reflection are counted as one.

Input

The first line contains the number of sticks N (6 ≤ N ≤ 80). The second line contains N natural numbers separated by spaces, representing the stick lengths. Each length is at least 1 and at most 1,000,000.

Output

Print the number of different hexagons that satisfy the conditions.