SnowballSH recently learned $$$n$$$ new words in Japanese. To enhance his learning, he wants to develop a method to determine the similarity between any two words.
To start, for each $$$i=1,2,\dots,n$$$, SnowballSH gives each word $$$i$$$ a positive integer score $$$a_i$$$.
Given two indices $$$i$$$ and $$$j$$$ $$$(1 \le i \lt j \le n)$$$, SnowballSH defines the distance between words $$$i$$$ and $$$j$$$ as $$$$$$\mathrm{dist}(i,j) = a_i + a_j.$$$$$$
To measure how well this function represents the order in which he learned the new words, SnowballSH calls an ordered pair $$$(i, j)$$$ $$$(1 \le i \lt j \le n)$$$ beautiful if and only if $$$$$$j - i = \mathrm{dist}(i,j).$$$$$$
Please help SnowballSH determine the number of beautiful pairs.
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of test cases.
The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$ — the number of words SnowballSH has learned.
The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 2 \cdot 10^5)$$$, indicating word $$$i$$$ has score $$$a_i$$$.
It is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output the number of ordered pairs $$$(i, j)$$$ where $$$1 \le i \lt j \le n$$$ such that $$$(i, j)$$$ is beautiful.
393 1 4 1 5 9 2 6 532025 2025 2025132 7 1 8 2 8 1 8 2 8 4 5 9
305
For test case 1:
For example, when $$$(i,j)=(4,7)$$$, we have $$$j-i=7-4=3$$$ and $$$\mathrm{dist}(i,j)=a_i+a_j=1+2=3$$$, so $$$(4,7)$$$ is beautiful.
Only the three pairs $$$(i,j)=(1,9),(2,4),(4,7)$$$ are beautiful, so output 3.
| Name |
|---|


