AT_abc417_c [ABC417C] Distance Indicators

Description

You are given an integer sequence $ A=(A _ 1,A _ 2,\ldots,A _ N) $ of length $ N $ . Find how many pairs of integers $ (i,j)\ (1\le i\lt j\le N) $ satisfy $ j-i=A _ i+A _ j $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ A _ 1 $ $ A _ 2 $ $ \ldots $ $ A _ N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 For example, when $ (i,j)=(4,7) $ , we have $ j-i=7-4=3 $ and $ A _ i+A _ j=1+2=3 $ , so $ j-i=A _ i+A _ j $ . In contrast, when $ (i,j)=(3,8) $ , we have $ j-i=8-3=5 $ and $ A _ i+A _ j=4+6=10 $ , so $ j-i\ne A _ i+A _ j $ . Only the three pairs $ (i,j)=(1,9),(2,4),(4,7) $ satisfy the condition, so output `3`. ### Sample Explanation 2 There may be no pairs that satisfy the condition. ### Constraints - $ 1\le N\le2\times10 ^ 5 $ - $ 1\le A _ i\le2\times10 ^ 5\ (1\le i\le N) $ - All input values are integers.