eolymp
bolt
Try our new interface for solving problems
Problems

Birches

Birches

National Forest state Q recently got a beautiful birch alley, which consists of $n$ trees. Each tree has a height of $H_i$. International Classification of national parks is a list of the most beautiful nature reserves in the world. Used to rank parks such a thing as \textbf{distinctiveness} which is understood as the number of pairs $(i, j)$, for which the observed ratio of $H_i\:mod\:H_j = k$, where $k$ is a special number, which is selected by the Expert Council of the international organization of national parks. What \textbf{distinctiveness} has national park state Q? \InputFile The first line has two positive integers $n$ and $k\:(1 \le n \le 10^5, 0 \le k \le 10^6)$ --- the number of trees in the national park and a special number of the advisory council, respectively. The second line has $n$ numbers $H_i\:(1 \le H_i \le 10^6)$ --- the height of the trees in the park. \OutputFile In the single line print Q national park \textbf{distinctiveness}.
Time limit 2 seconds
Memory limit 128 MiB
Input example #1
5 1
1 2 3 4 5
Output example #1
8
Source IZHO 2019 Selection Contest, Dec. 29 2018, Baku