from collections import Counter n = int(input()) a = list(map(int, input().split())) for i in range(n): a[i] -= i hist = Counter(a) res = 0 for x, c in hist.items(): res += c * (c - 1) // 2 print(res)