시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 512 MB13137100.000%

문제

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}, \ldots, p_{n})$, the task is to find the number of pairs of indices $(i, j)$ such that $i < j$ and $p_{i}$ is a multiple of $p_{j}$.

Help Vasya solve this problem.

입력

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

출력

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

예제 입력 1

5
1 4 3 2 5

예제 출력 1

1

예제 입력 2

5
5 4 3 2 1

예제 출력 2

5