Under construction

Still being built. Things may change

Multiplication

Interview

Time limit2sMemory limit1024 MB

Summary
Count the triples i < j < k with A[i] * A[j] = A[k] in an array of at most 100 positive integers.
Level

Easy3 of 10

Topics
Brute force, Array, Implementation
Solved
No attempts yet

Problem

Aoi, a student at JOI High School, found a scroll in the library. The scroll has N integers written in a row, and the i-th number from the left (1 ≦ i ≦ N) is Ai.

Looking at the scroll, Aoi wondered: "If I choose 3 of these N integers and call them x, y, z in order from left to right, how many ways are there to choose integers such that x × y = z?"

Given the N integers written on the scroll, write a program to find the answer to Aoi's question.

Input

The input is given from standard input in the following format.

N
A1 A2 … AN

Output

Print the answer to Aoi's question to standard output in 1 line.

Constraints

  • 3 ≦ N ≦ 100.
  • 1 ≦ Ai ≦ 999 (1 ≦ i ≦ N).
  • All input values are integers.

Examples4

  1. Example 1

    Input
    3
    21 13 273
    
    Expected output
    1
    
  2. Example 2

    Input
    3
    10 5 2
    
    Expected output
    0
    
  3. Example 3

    Input
    5
    4 2 2 8 16
    
    Expected output
    4
    
  4. Example 4

    Input
    10
    1 1 1 1 1 1 1 1 1 1
    
    Expected output
    120