Solve the programming task below in a Python markdown code block.
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef has a sequence $A_{1}, A_{2}, \ldots, A_{N}$. He needs to find the number of pairs $(i, j)$ ($1 ≤ i < j ≤ N$) such that $A_{i} + A_{j} = A_{i} \cdot A_{j}$. However, he is busy, so he asks for your help.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single integer $N$.
The second line contains $N$ space-separated integers $A_{1}, A_{2}, \ldots, A_{N}$.

------  Output ------
For each test case, print a single line containing one integer ― the desired number of pairs.

------  Constraints ------
$1 ≤ T ≤ 20$
$1 ≤ N ≤ 40,000$
$0 ≤ A_{i} ≤ 10^{9}$ for each valid $i$

------  Subtasks ------
Subtask #1 (30 points): $1 ≤ N ≤ 500$

Subtask #2 (70 points): original constraints

----- Sample Input 1 ------ 
2

3

2 4 2

3

0 2 3
----- Sample Output 1 ------ 
1

0
----- explanation 1 ------ 
Example case 1: The only valid pair is $(1, 3)$.

Example case 2: We can see that no valid pair exists.