#P7517. [省选联考 2021 B 卷] 数对

[省选联考 2021 B 卷] 数对

Problem Description

Given nn positive integers aia_i, please find how many ordered pairs (i,j)(i, j) satisfy 1in1 \le i \le n, 1jn1 \le j \le n, iji \ne j, and aia_i is a multiple of aja_j.

Input Format

The first line contains an integer nn, representing the number of integers.

The second line contains nn integers, representing aia_i.

Output Format

Output one line with one integer, representing the answer.

6
16 11 6 1 9 11

7

Hint

For 40%40\% of the testdata, n1000n \le 1000.

For 70%70\% of the testdata, 1ai5×1031 \le a_i \le 5 \times {10}^3.

For 100%100\% of the testdata, 2n2×1052 \le n \le 2 \times {10}^5, 1ai5×1051 \le a_i \le 5 \times {10}^5.

Translated by ChatGPT 5