n = int(eval(input()))

A = list(map(int, input().split()))

B = [A[i] - i for i in range(n)]

C = [-A[i] - i for i in range(n)]



# Bの要素それぞれに対するCの中ある等しいものの数の総和



C.sort()

from bisect import *



ans = 0



for b in B:

    ans += bisect(C, b) - bisect_left(C, b)



print(ans)

n = int(eval(input()))

A = list(map(int, input().split()))

C = sorted([-A[i] - i for i in range(n)])

from bisect import *

print((sum(bisect(C, b) - bisect_left(C, b) for b in [A[i] - i for i in range(n)])))

n = int(eval(input()))
A = list(map(int, input().split()))
B = [A[i] - i for i in range(n)]
C = [-A[i] - i for i in range(n)]
# Bの要素それぞれに対するCの中ある等しいものの数の総和
C.sort()
from bisect import *

ans = 0
for b in B:
    ans += bisect(C, b) - bisect_left(C, b)
print(ans)

n = int(eval(input()))
A = list(map(int, input().split()))
C = sorted([-A[i] - i for i in range(n)])
from bisect import *

print((sum(bisect(C, b) - bisect_left(C, b) for b in [A[i] - i for i in range(n)])))

-B = [A[i] - i for i in range(n)] -C = [-A[i] - i for i in range(n)] -# Bの要素それぞれに対するCの中ある等しいものの数の総和 -C.sort() +C = sorted([-A[i] - i for i in range(n)]) -ans = 0 -for b in B: -    ans += bisect(C, b) - bisect_left(C, b) -print(ans) +print((sum(bisect(C, b) - bisect_left(C, b) for b in [A[i] - i for i in range(n)])))