C - Triplet Product Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

問題文

長さ N の整数列 A = (A_1, \dots, A_N) が与えられます。

次の条件を満たす整数 X の個数を求めてください。

  • A_i \times A_j \times A_k = X かつ 1 \leq i \lt j \lt k \leq N を満たす整数 i, j, k が存在する。

制約

  • 3 \leq N \leq 100
  • 1 \leq A_i \leq 100 \, (1 \leq i \leq N)
  • 入力は全て整数

入力

入力は以下の形式で標準入力から与えられる。

N
A_1 \ldots A_N

出力

答えを出力せよ。


入力例 1

4
2 1 3 2

出力例 1

3

X = 4, 6, 12 が条件を満たします。


入力例 2

10
3 1 4 1 5 9 2 6 5 3

出力例 2

37

Problem Statement

You are given an integer sequence of length N: A = (A_1, \dots, A_N).

Find the number of integers X that satisfy the following condition.

  • There are integers i, j, and k such that A_i \times A_j \times A_k = X and 1 \leq i \lt j \lt k \leq N.

Constraints

  • 3 \leq N \leq 100
  • 1 \leq A_i \leq 100 \, (1 \leq i \leq N)
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

N
A_1 \ldots A_N

Output

Print the answer.


Sample Input 1

4
2 1 3 2

Sample Output 1

3

X = 4, 6, and 12 satisfy the condition.


Sample Input 2

10
3 1 4 1 5 9 2 6 5 3

Sample Output 2

37