6658: ABC249 — D - Index Trio
[Creator : ]
Description
You are given an integer sequence $A = (A_1, \dots, A_N)$ of length $N$.
Find the number of triplets of integers $(i, j, k)$ satisfying all of the conditions below.
Find the number of triplets of integers $(i, j, k)$ satisfying all of the conditions below.
- $1 \leq i, j, k \leq N$
-
$\frac{A_i}{A_j} = A_k$
Input
Input is given from Standard Input in the following format:
$N$
$A_1\ \ldots\ A_N$
$N$
$A_1\ \ldots\ A_N$
Output
Print the answer.
Constraints
$1≤N≤2×10^5$
$1 \leq A_i \leq 2 \times 10^5 \, (1 \leq i \leq N)$
All values in input are integers.
$1 \leq A_i \leq 2 \times 10^5 \, (1 \leq i \leq N)$
All values in input are integers.
Sample 1 Input
3
6 2 3
Sample 1 Output
2
$(i,j,k)=(1,2,3),(1,3,2)$ satisfy the conditions.
Sample 2 Input
1
2
Sample 2 Output
0
Sample 3 Input
10
1 3 2 4 6 8 2 2 3 7
Sample 3 Output
62