Divisible Inversions

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Recently, Vasya learned how to calculate the number of inversions in a given permutation using Fenwick tree. However, Petya considers it an easy problem, so he decided to make a harder one. Petya asked Vasya to calculate the number of inversions such that the elements divide one another evenly. Formally, for the given permutation (p_1,p_2,,p_n)(p\_{1}, p\_{2}, \ldots, p\_{n}), the task is to find the number of pairs of indices (i,j)(i, j) such that i<ji < j and p_ip\_{i} is a multiple of p_jp\_{j}.

Help Vasya solve this problem.

입력

The first line contains an integer nn, the length of the permutation (1n100,0001 \le n \le 100\\,000). The second line contains nn space-separated integers p_ip\_{i}. It is guaranteed that the given integers form a permutation of integers from 11 to nn.

출력

Print one integer: the number of divisible inversions in the given permutation.