#Lutece1572. Espec1al Triple

Espec1al Triple

Migrated from Lutece 1572 Espec1al Triple

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

In mathematics, a geometric progression, also known as a geometric sequence, is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed, non-zero number called the common ratio.

For example, the sequence 2,6,18,54,2, 6, 18, 54, \dots is a geometric progression with common ratio 33. Similarly 10,5,2.5,1.25,10, 5, 2.5, 1.25, \dots is a geometric sequence with common ratio 0.50.5.

Now you are given NN numbers x1,x2,,xNx_1, x_2, \dots, x_N, there are (N3)\binom{N}{3} ways to choose three numbers from them, calculate how many ways to choose three numbers such that the numbers you chosen can form a geometric sequence.

Input

The first line contains an integer NN.

The second line contains NN integers x1,x2,,xNx_1, x_2, \dots, x_N.

1N1061 \leq N \leq 10^6, 1xi1051 \leq x_i \leq 10^5.

Output

How many ways to choose three numbers such that the numbers you chosen can form a geometric sequence.

Samples

9
1 2 3 4 5 6 7 8 9
4
9
1 1 1 2 2 2 4 4 4
30
3
2 4 1
1

Resources

The 15th UESTC Programming Contest Final