| SashaT9 Contest 1 |
|---|
| Finished |
You are given an array $$$a_1, \dots, a_n$$$. Your task is to count the number of pairs $$$1 \leq i \lt j \leq n$$$ for which $$$\gcd(a_i + j, a_j + i) = i + j$$$.
The first contains a single integer $$$n$$$ ($$$2\le n\le 2\cdot 10^5$$$) — the length of the array $$$a$$$.
The second line contains $$$n$$$ integers $$$a_1, \dots, a_n$$$ ($$$1 \leq a_i \leq 2\cdot 10^5$$$) — elements of array $$$a$$$.
Output the number of pairs that satisfy the condition.
6 13 20 11 16 11 5
4
5 1 2 3 4 5
10
In the first sample, there are four pairs:
In the second sample, each pair satisfies the condition.
| Name |
|---|


