Matching Difference Pairs


Submit solution

Points: 10
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Matching Difference Pairs

Count index pairs (i, j) with i < j for which aᵢ − i = aⱼ − j. Indices are one-based.

Input

The first line contains n (1 ≤ n ≤ 200000). The second line contains n integers |aᵢ| ≤ 10^9.

Output

Print the number of matching pairs.

Example 1

Input

5
3 4 5 8 9

Output

4

Example 2

Input

4
1 2 3 4

Output

6


Comments

There are no comments at the moment.